Archive | science RSS for this section

Simple surface plot in gnuplot

Here’s a random example for no good reason.

Here is the gnuplot script (surfaceplot.gp):

set iso 30
set samp 50
unset key
#set title "sin(r)"
set xlabel "x" font "Times:Italic,14"
set ylabel "y" font "Times:Italic,14"
set zlabel "z" font "Times:Italic,14"
set xrange [-4:4]
set yrange [-4:4]
set xtics offset -0.5,-0.5
set ztics 1
unset surf
set style line 1 lt 4 lw 0.5
set pm3d
set term post level1 color font "Times,12" fontscale 1.0
set output "plotfile.eps"
splot sin(sqrt(x**2+y**2))

Here are the commands run at the command line:

$ gnuplot surfaceplot.gp 
$ epspdf plotfile.eps
$ xpdf plotfile.pdf
$ pdftoppm.exe -r 600 plotfile.pdf > plotfile.ppm
$ convert plotfile.ppm plotfile.png
$ display plotfile.png
$ rm plotfile.ppm

And this gives me an eps, a pdf and a png:

89K  plotfile.eps
56K  plotfile.pdf
990K plotfile.png
A coloured surface plot drawn in gnuplot using the script above

Yep

And here’s a simple script to plot sections through the surface:

$ cat cuts.gp 
unset key
#set title "sin(r)"
set xlabel "x" font "Times:Italic,18"
set ylabel "z" font "Times:Italic,18"
set xrange [-4:4]
set yrange [-1:1]
set border lw 0.25
#set style line 1 lt 4 lw 0.5
set term post level1 color font "Times,12" fontscale 1.0
set output "plotfile-cut-y=0.eps"
plot sin(sqrt(x**2+0**2)) lc rgb 'black' lw 4
set output "plotfile-cut-y=1.eps"
plot sin(sqrt(x**2+1**2)) lc rgb 'black' lw 4

And here is plotfile-cut-y=1

A section through the surface, where y=1; looks a bit like a capital M

Section where y=1

 ;ouihgvanieiogywev9np

PM Scott Morrison, religion, and fitness to govern

Rant: on

We often hear the argument that a person’s personal religious views are not relevant to their role in government.

Bullshit.

If someone is going to make decisions that affect me and my children and so on into the future, I want that someone to have an understanding of the processes of science and knowledge gathering, and to appreciate that not all data are equal and that some people know what they are talking about and some don’t. If that decision maker lives in a belief structure that prevents them from doing that, they are not fit to govern.

Let’s take the obvious example — climate science. A crucial aspect of climate science is time scales. Ice cores going back 2.7 million years show us not just whether the world has ever been this hot or had this much carbon in the air but, even more crucially, how quickly the levels change. The rate of change on human time scales we are seeing now is completely unprecedented (though not unpredicted), but if you believe that the world is 6000 years old, then all of time is the human time scale and you are literally incapable of understanding the evidence. Therefore incapable of formulating adequate policy about it, therefore incapable and unfit for government.

Simple.

Similarly, if they believe that one group (say, Christians) is worthy and is going to be saved and go to heaven, and the rest of us are going to hell and deserve punishment unless we change our ways, how can they then say the serve us all, govern for us all? They can’t. Either they believe one group is special, or they don’t.

Clearly, I am an atheist. I’d like to believe in something beyond the material world. I just don’t see it.

For example, prayer. Ain’t it remarkable how prayer has healed a lot more people after the invention of penicillin? These days so many more people survive illness, many of them infidels, unbelievers and downright awful people. A few hundred years ago, the most innocent of babies (though don’t get me started on the insanity of original sin) or devout of believers died a lot more often than the most heinous of blasphemers do now.

Gee, maybe it’s because prayer does not work and penicillin does.

That is, faith does not work but hard work and science and thinking do. (Oh, sure, faith might work on the personal level of making people feel better about themselves, or guiding them in their actions — rather like meditation — and that might lead that person to be a better influence in the world; though faith often seems to guide people to do pretty unsociable things).

If this Prime Minster is not prepared to be guided by hard work and science and thinking, then his decisions will be as bad as someone using prayer instead of antibiotics. I don’t want that doctor, and I don’t want that Prime Minister. I mean, his job is, basically, to make decisions. If he’s going to do that based on an illogical belief system, he’s got to go.

I don’t care how personal his beliefs are, they are not personal, they are national. If he wants the luxury of personal beliefs, he cannot be Prime Minister.

Rant: off

Science writing versus scientific writing

With the shift away from third person passive to active first person writing:

The boiling point of the compound was determined.

Becomes

We determined the boiling point of the compound.

Now, for science writing (ie popular science), this is fine. For scientific writing, I am not so sure.

What do I mean by scientific writing?

I mean writing that has the same qualities as science itself. This is different from writing about science itself, or even writing about the results of science in a non-scientific way. We might call these latter two things ‘science writing’.

Science, to me, ought to be:

  • precise — even when uncertain, it should be precise about what is highly likely (give nothing can be ‘proven’), likely, possible or unlikely. In other words, science aims for precise and accurate results, but regardless of the precision and accuracy of the results is always precise about its degree of certainty
  • dispassionate — the whole point of science is that what humans think is not relevant to the correctness of a theory (even though what humans think will have led to the theory). The validity of an idea is tested against the universe, not against what people think; an experiment is a means of testing whether an idea is consistent with the way the universe operates

In my mind, scientific writing has these same attributes.

With scientific knowledge, it does not matter who did the experiment, only that it was done well so that the experiment really does (within whatever limits) test the idea’s validity. Of course, some people have a wonderful ability to think of an experiment no-one else has ever done. But once it has been done and written up, if repeated it should yield the same results.

So I don’t like the ‘We’ in the sentence above. It puts the experimenter at the focus — after all, they are now the subject of the sentence — when previously the result (the boiling point of the compound) was the subject. And the boiling point is what matters, and what (if done well) ought to be a valuable result for others to draw on.

Personalising scientific results allows a theory or experiment to be discredited by discrediting the theorist or experimenter. It puts a scientific result closer to the plane of an opinion or ideology than it ought to be, so making it easier to argue away. Science is the opposite of ideology. Ideology is the use of a framework of ideas to make decisions for you en masse and so avoid having to think. I’m not saying scientists never do that (they are humans), but when they do they are not doing science.

If the sense that science is objective (as much as any human activity can be) was more prevalent in the wider world, it would be harder for (for example) climate change denialists to get traction. And I can’t help thinking that maybe that objectivity ought to be embedded in the language of science, and that if we take it out we’re implicitly signalling that science is something less important and useful and relevant and non-ignorable than it is.

So while I can understand the shift to the more active and immediate in writing, and I agree with it in most cases, I find myself not so in favour of it when talking about science and its outputs. (Having said that, I’ve written plenty of papers that use ‘we’, sometimes at the behest of a coauthor, sometimes because working around it was just so clunky and wordy; but always with a nagging dis-ease.)

I guess I’m just as inconsistent as anybody.

Rant over.

New e-learning modules about writing and editing – please help! Fabulous prizes to be won!

At Biotext, where I work, we are developing e-learning modules about writing, editing and presenting information, and we need your help.

To make sure we design modules that are as useful and accessible as possible, we’d love to hear about your preferences. Please complete our brief survey to tell us how you might use the modules and what topics you would like to see.

The modules will be part of the Australian manual of scientific style (AMOSS), which is being expanded to include general content and will be renamed the Australian manual of style (AMOS). The modules will include text, video, audio, images, interactive elements and quizzes.

By completing the survey you will have a chance to receive a free 1-year subscription to AMOSS/AMOS – 5 to be won!

 

Click here to go to the survey

Thanks!

The Prime Minister of Australia is either a hypocrite or a fool

If he cannot recognise the need to battle climate change, he’s a fool.

If he does recognise the need to battle climate change, then his response to it is utterly hypocritical.

It’s one or the other.

Successful science writing and editing at Biotext

Click for event brite page

On 13 Nov 2019, we (that is to say Biotext, where I work) will be running our popular course about writing reports, thesis and other documents with technical and scientific content. It will take place in our Bruce offices (that is, in Canberra) from 0930 to 1430.

To register or just have a look, you can go to EventBrite.

Click for event brite page

To get a look at the course outline, click on this thumbnail.

Successful science writing course outline

(Main content repeated in text at end of posting.)

Contact me if it’s of any interest. This is a commercial product, and I would not normally post on such a topic, but we’re a small business and we get our message out how we can.

 

Training.

——————————————————————————————-

Course topics

Common problems – looks at examples of typical science writing from a range of sources.

Where to start – outlines a set of questions to ask when first working on a document.

Writing clearly and succinctly – looks at how to avoid pitfalls of scientific writing such as overuse of jargon, passive voice and weak verbs and nouns.

Improving documents through editing – explains where substantive editing fits in the process of producing a document; and covers the different aspects of this stage, such as overall structure, content and logical flow.

‘Bare bones approach’ – outlines how to use a simple checklist to determine what level of editing a document requires. The checklist is useful in assessing your own work or in giving feedback to others.

Error bars and column graphs in gnuplot

Largely a note to myself, so I remember how I did it. May not be the best way…!

I want to draw a bar chart with error bars.

Here is some model data:

# Mon mm lo hi 
Jan 11 09 13
Feb 12 10 14
Mar 23 21 25
Apr 34 30 40
May 45 40 50
Jun 56 50 60
Jul 67 60 70
Aug 67 60 70
Sep 78 70 83
Oct 67 60 70
Nov 78 75 88
Dec 67 60 77

Say it’s rainfall, with the last two columns being the error interval. Whatever.

I go to the command line and type:

$ gnuplot simple-bar.gnuplot

And I get this:

Plot with blue columns and arbitrary error bars

My plot

How? Here is the script:

# Lines beginning with # are comments
#
# This file is used by running gnuplot from the command line like this:
# $ gnuplot simple-bar.gnuplot
# where $ is the command prompt (eg C:etc\> if on Windows)
#
# The file plots the data in xy.day according to the instructions given.
#
# The lines below are like global options, including the size and the output format. Use 
# the commented-out line for transparency. Useful terminal types (ie output types)
# include: emf, jpeg, postscript, png, pngcairo, pdfcairo, svg, xterm, x11 and dumb.
# Each has its own subset of options.
#set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 600, 400 
set terminal pngcairo enhanced font "arial,10" fontscale 1.0 size 600, 400 
# Output file name
set output 'simple-bar.png'
# Type of graph
set style data histogram
# Visual details -- solid fill, 0.5 transparency
set style histogram cluster gap 1
set style fill solid 0.5
set boxwidth 0.9
# No xtics, but we do want labels, and do not mirror tics (ie show at top)
set xtics format "" nomirror
# y tic marks plus grid lines
set grid ytics
# Control the look of the error bars
set style histogram errorbars linewidth 1 
set errorbars linecolor black
set bars front
# Define some custom colours using RGB; can also use standard names ("blue")
red = "#FF0000"; green = "#00FF00"; blue = "#0000FF"; skyblue = "#87CEEB";
# We don't set a title -- but we could by uncommenting this next line
#set title "A Sample Bar Chart"
#The legend ('key') -- single data set does not need one
unset key
# But if we want a legend, uncomment this
# set key on outside center bottom 
# y axis label and range -- no details needed for x axis
set ylabel "Rainfall (mm)"
set yrange [0:100]
# Actually do the plot; use cols 2-4 from the file; linecolor gives the color, 
# linewidth 0 removes the outline of the column
plot "xy.dat" using 2:3:4:xtic(1) title "Rain (mm)" linecolor rgb skyblue linewidth 0
# if we want to output in more formats, we can add more set term lines and more output names
# and replot; but graphs will not be identical since the drivers and file types have
# different limitations and defaults (eg what is a line thickness of '1'?)
set term svg enhanced font "arial,13" fontscale 1.0 size 600, 400 background "white"
set output 'simple-bar.svg'
replot
set term postscript eps level1 color font "Helvetica,12" fontscale 1.0 size 9cm, 6cm
#set term postscript eps level1 enhanced color font "arial,12" fontscale 1.0 size 600, 400 
set output 'simple-bar.eps'
replot

Good luck!

Successful science writing and editing at Biotext

On 13 Nov 2019, we (that is to say Biotext, where I work) will be running our popular course about writing reports, thesis and other documents with technical and scientific content. It will take place in our Bruce offices (that is, in Canberra) from 0930 to 1430.

To register or just have a look, you can go to EventBrite.

Click for event brite page

To get a look at the course outline, click on this thumbnail.

Successful science writing course outline

(Main content repeated in text at end of posting.)

Contact me if it’s of any interest. This is a commercial product, and I would not normally post on such a topic, but we’re a small business and we get our message out how we can.

 

Training.

——————————————————————————————-

Course topics

Common problems – looks at examples of typical science writing from a range of sources.

Where to start – outlines a set of questions to ask when first working on a document.

Writing clearly and succinctly – looks at how to avoid pitfalls of scientific writing such as overuse of jargon, passive voice and weak verbs and nouns.

Improving documents through editing – explains where substantive editing fits in the process of producing a document; and covers the different aspects of this stage, such as overall structure, content and logical flow.

‘Bare bones approach’ – outlines how to use a simple checklist to determine what level of editing a document requires. The checklist is useful in assessing your own work or in giving feedback to others.

My ORCID QR code

Never used one myself, but here it is! ORCID is what it says here.

QR code for my ORCID account

Whatever.

QR code for my ORCID account

Whatever, thumbnail size.

 

 

Me there

Climate strike!

On September 20th, 2019, Biotext, where I work, is joining the climate strike.

https://www.notbusinessasusual.co/

https://www.schoolstrike4climate.com/sept20

I congratulate the Biotext management for their wisdom and foresight.

 

climate