HiPERCAM commands¶
This page documents the pipeline commands which are all part of
hipercam.scripts. Help on any given command can be obtained at the
terminal using e.g. pydoc hipercam.scripts or pydoc
hipercam.scripts.rtplot. This is often the most useful way to get
information quickly. If you are new to the pipeline, it would be worth reading
the Parameter specification section on how to call the pipeline commands and
specify parameters.
Main commands¶
This section lists the main HiPERCAM commands [1] ; see also the bottom of the page for all the documentation on the commands in one long list. Clicking on a command name in the table below will take you to the relevant section of this long list. The table also indicates contexts in which each command is particularly useful.
Command |
Purpose |
Observing |
Reduction |
Plots & analysis |
Arithematic |
Information |
|---|---|---|---|---|---|---|
|
add two frames |
Yes |
||||
|
average a series of frames in a run |
Yes |
Yes |
|||
|
add a constant to a frame |
Yes |
||||
|
divide a frame by a constant |
Yes |
||||
|
multiply a frame by a constant |
Yes |
||||
|
combine a list of frames |
Yes |
Yes |
Yes |
||
|
subtract a constant from a frame |
Yes |
||||
|
divide one frame by another |
Yes |
||||
|
plot reduce log readout noise loss factor |
Yes |
Yes |
Yes |
||
|
convert foreign FITs files to hcm format |
Yes |
||||
|
flag cloudy and junk data in a reduce log |
Yes |
Yes |
|||
|
automatically find targets using “sep” |
Yes |
Yes |
|||
|
create a reduce file |
Yes |
Yes |
|||
|
split frames out of a run |
Yes |
Yes |
|||
|
filter a HiPERCAM image |
Yes |
||||
|
lists information on a HiPERCAM image |
Yes |
||||
|
plot a histogram of a frame |
Yes |
Yes |
|||
|
produce ASCII column data from a reduce log |
Yes |
Yes |
Yes |
||
|
convert a reduction log file to FITS |
Yes |
Yes |
|||
|
list the runs on the HiPERCAM server |
Yes |
Yes |
|||
|
bundles up reduce data files |
Yes |
Yes |
Yes |
||
|
plot a frame |
Yes |
Yes |
Yes |
||
|
joins windows into a single image per CCD |
Yes |
Yes |
|||
|
list times of a run |
Yes |
||||
|
combine a run to make a bias frame |
Yes |
Yes |
|||
|
combine a run to make a dark frame |
Yes |
||||
|
combine a set of frames into a flat |
Yes |
||||
|
combine a set frames into a fringe map |
Yes |
Yes |
|||
|
makes stills for movies from a run |
Yes |
Yes |
|||
|
list stats of multiple frames from a run |
Yes |
||||
|
multiply two frames |
Yes |
||||
|
noise calibration |
Yes |
Yes |
Yes |
Yes |
|
|
plot frames as they come in [matplotlib] |
Yes |
Yes |
Yes |
||
|
plot |
Yes |
Yes |
|||
|
flexible plot of a |
Yes |
Yes |
|||
|
analyse a reduction log file |
Yes |
Yes |
|||
|
carry out photometric reduction |
Yes |
Yes |
|||
|
plot frames as they come in [pgplot] |
Yes |
Yes |
Yes |
||
|
updates old reduce files |
Yes |
Yes |
|||
|
define the photometric apertures |
Yes |
Yes |
|||
|
define a file of CCD defects |
Yes |
||||
|
define peak/trough pairs for fringe measurement |
Yes |
Yes |
|||
|
combine frames after aligning based on reduced positions |
Yes |
Yes |
|||
|
splice two frames together |
Yes |
||||
|
report statistics of a frame |
Yes |
||||
|
subtract two frames |
Yes |
||||
|
list the runs on the ULTRACAM server |
Yes |
Parameter specification¶
The pipeline commands are distinct from standard unix commands in having a ‘memory’, which is implemented through storage of inputs in disk files for each command, and also in prompting you if you don’t specify a parameter on the command line. Parameters can be ‘global’ or ‘local’ depending upon whether they are reset across multiple commands or just the command of interest. The parameter memory, along with the use of backslashes ‘\\’ to accept default values can save a huge amount of typing making for efficient operation once you get up to speed.
Basic parameter input¶
The command rtplot has more parameters than most others and is a
good one to start with (see also its replacement nrtplot). Suppose
then that we have a raw HiPERCAM file, run0076.fits, that we
want to plot. If we type ‘rtplot’ and follow the prompts, the first
few lines might be:
rtplot
run - run name [run0064]: run0076
first - first frame to plot [10]: 1
This shows that the last time rtplot was invoked, it was used to look
as run0064.fits starting with frame 10. Note that the extension
‘.fits’ is not needed: HiPERCAM makes significant use of extensions to
differentiate between different forms of file, all of which could be
associated with the same run and therefore start with the ‘run0064’ or whatever.
Alternatively we could have typed:
rtplot run0076
first - first frame to plot [10]: 1
which would accomplish the same, setting the run name according to its
position in the command-line arguments. For this to work, you need to be
certain of the ordering. If you are not sure of the order, but you are sure
that the parameter is called run, then:
rtplot run=run0076
first - first frame to plot [10]: 1
will do, and the first two parameters could be similarly specified:
rtplot first=1 run=run0076
Note that by naming the parameters, the order becomes immaterial. Now,
assuming that the command was completed, if you run rtplot again you
might get:
rtplot
run - run name [run0076]:
first - first frame to plot [1]:
ccd - CCD(s) to plot [0 for all] [3]: 3 4
nx - number of panels in X [2]:
bias - bias frame ['none' to ignore] [none]:
msub - subtract median from each window? [False]: True
You will see that the defaults for run and first have been updated by
the previous invocations of the command. This the parameter “memory” referred
to earlier. Now suppose that we wish to repeat the command without changing
any parameter. Then a simple:
rtplot \\
will do. The double backslash ‘\\\\’ indicates “take the default value for all remaining parameters”. Two are needed because the shell will strip one of them. If you let at least one prompting line be output then a single backslash will accomplish the same thing:
rtplot
run - run name [run0076]: \
If you wish to change just one parameter, say msub, then much typing can
be saved with:
rtplot msub=no \\
(NB: Boolean True/False parameters like msub can be reset False with either
‘no’, ‘false’ or even just ‘n’.) Combined with up and down arrow keys, and
commands can be quickly repeated or modified.
Strings with spaces¶
If you need to specify a string with a space in it, either let a command prompt you and type as normal, or quote it on the command line, e.g.:
rtplot run="silly file name" \\
Setting a string to be blank¶
If you want to set a string to a blank, then a carriage return won’t work when prompted for it since this will just keep whatever default is set. Instead type ‘’ (two single quotes) which will be interpreted as implying an empty string.
Parameter ranges¶
Many numerical parameters have mimimum and/or maximum values set. Typing ‘?’ at the prompt should tell you what the values are. Typing ‘min’ or ‘max’ will set the parameter to have the appropriate value.
Tab completion¶
File name input is helped by tab completion: start typing, hit <tab> and if the file exists, the name might be completed.
Global vs local parameters¶
All HiPERCAM pipeline parameters fall into one of two classes, either being
‘local’ to a command or ‘global’ to multiple commands. The run parameter
of rtplot for instance also appears in grab and if you change it in
rtplot, it will be changed in grab. This is very useful when running
a series of commands on the same file as the commands almost ‘know’ what you want,
saving much typing.
Trouble-shooting parameter input¶
It very rarely happens that the file I/O needed to read the default values can get confused. This can happen e.g. if the data type of a parameter has changed. If very odd things seems to happen when you try to start a command, then you might want to track down where the default files are located. Usually this will be in .hipercam in your home directory, unless the environment variable HIPERCAM_ENV has been defined to re-direct where the default files are stored. Once you have located them it is always safe to delete one or more or all of the default files (end with .def). The worst that happens is that the commands have lost the default values.
Errors reported by scripts¶
If you use the pipeline for any significant time, you will at some point get a rather forbidding-looking error traceback such as:
reduce run=run013 \\
Traceback (most recent call last):
File "/storage/astro1/phsaap/software/python/bin/reduce", line 11, in <module>
load_entry_point('hipercam==0.19.9.dev22+g758df9d.d20200303', 'console_scripts', 'reduce')()
File "/storage/astro1/phsaap/software/python/lib/python3.6/site-packages/hipercam/scripts/reduce.py", line 405, in reduce
with spooler.data_source(source, resource, first, full=False) as spool:
File "/storage/astro1/phsaap/software/python/lib/python3.6/site-packages/hipercam/spooler.py", line 323, in data_source
return UcamDiskSpool(resource, first)
File "/storage/astro1/phsaap/software/python/lib/python3.6/site-packages/hipercam/spooler.py", line 108, in __init__
self._iter = ucam.Rdata(run, first, False)
File "/storage/astro1/phsaap/software/python/lib/python3.6/site-packages/hipercam/ucam.py", line 637, in __init__
Rhead.__init__(self, run, server)
File "/storage/astro1/phsaap/software/python/lib/python3.6/site-packages/hipercam/ucam.py", line 152, in __init__
udom = xml.dom.minidom.parse(run + '.xml')
File "/warwick/desktop/2018/software/MPI/GCC/7.3.0-2.30/OpenMPI/3.1.1/Python/3.6.6/lib/python3.6/xml/dom/minidom.py", line 1958, in parse
return expatbuilder.parse(file)
File "/warwick/desktop/2018/software/MPI/GCC/7.3.0-2.30/OpenMPI/3.1.1/Python/3.6.6/lib/python3.6/xml/dom/expatbuilder.py", line 910, in parse
with open(file, 'rb') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'run013.xml'
Yikes! Although it looks awful, it simply reflects the chain of function calls that led to the problem, an extremely useful diagnostic of problems in Python code. Such tracebacks look a bit ugly, but almost certainly, in most cases, including this one, they are caused by incorrect parameter inputs. The one to look at is probably the last line or two, which reveals in this case that an expected file ‘run013.xml’ was not found; a directory listing would confirm this.
Such errors follow from a standard Python approach of not trying to add endless checking code, but to let the code tell you what happened when errors are encountered. This has the merit of being very informative (and de-clutters code), but it can make it hard to distinguish between an essentially trivial issue, such as a missing file, and a genuine problem with the code. If however you find you can’t get round a problem and the error reported does not look innocent, then it might be a time to report the problem. We will do our best to provide fast solutions to critical issues.
Command definitions¶
This section contains documentation auto-generated from the code. This
is the same as is returned from clicking command names in the lists at
the top of this page or from using pydoc in a terminal (e.g. try
pydoc hipercam.scripts.reduce). Each command appears as a function
(an implementation detail), followed by a highlighted line showing the
parameters one can use on the command-line. Inputs in square brackets
such as [source] are hidden by default; those in round brackets
e.g. (plot) may or may not be prompted depending upon earlier
inputs. It is always safest when first running a command simply to
type its name and hit enter and let the command itself prompt you for
input. Many commands have hidden parameters that can only be revealed
by typing e.g. rtplot prompt. These are usually parameters that
rarely need changing, but you are sure sometimes to need to alter
them. See the Parameter specification section for details on how to
specify command parameters.
In the one-line descriptions below, run refers to a complete run,
containing multiple images, stored in a .fits file. frame refers to a
single image from a run as might be extracted using grab. These have file
extension ‘.hcm’ to distinguish them, although they are also FITS-format files.