hipercam.hlog¶
hlog is a sub-module for reading in the log files written by
reduce. It defines one class hipercam.hlog.Hlog
to hold log
files and another hipercam.hlog.Tseries
to represent time
series to allow quick development of scripts to plot results.
For example, suppose a log file ‘eg.log’ has been written with 2 CCDs, ‘1’ and ‘2’, and that CCD ‘2’ has apertures labelled ‘1’ and ‘2’ for target and comparison. Then the following commands would load it, divide target by comparison and plot the result with matplotlib:
>> import matplotlib.pyplot as plt >> import hipercam as hcam >> >> hlog = hcam.hlog.Hlog.rascii(‘ts.log’) >> targ = hlog.tseries(‘2’,’1’) >> comp = hlog.tseries(‘2’,’2’) >> >> ratio = targ / comp >> ratio.mplot(plt, ‘r’) >> plt.show()
hipercam.hlog.Tseries
objects know about bad data and carray
a bitmask array reflecting problems flagged during reduction.
Classes summary
Class to represent a HiPERCAM log as produced by reduce. |
|
|
Class representing a basic time series with times, y values, y errors and flags, and allowing bad data. Attributes are::. |
-
class
hipercam.hlog.
Hlog
¶ Bases:
dict
Class to represent a HiPERCAM log as produced by reduce. Based on dictionaries, Hlog files contain numpy structured arrays for each CCD which can be accessed by the CCD label name. Each array contains data that can be accessed by the label of the column. e.g.
>> import hipercam as hcam >> hlog = hcam.hlog.Hlog.rascii(‘run011.log’) >> print(hlog[‘2’][‘x_1’])
would print the X-values of aperture ‘1’ from CCD ‘2’.
Hlog objects have four attributes:
‘apnames’, a dictionary keyed by CCD label giving a list of the aperture labels used for each CCD. i.e.
>> print(hlog.apnames[‘2’])
might return [‘1’,’2’,’3’].
- ‘cnames’, a dictionary keyed by CCD label giving a list of the column
names in the order they appeared in the original file. This is to help write out the data
‘comments’, a list of strings storing the header comments to allow the Hlog to be written out with full information if read from an ASCII log.
‘writable’, a flag to say whether the Hlog can be written which at the moment is only true if it has been read from an ASCII HiPERCAM log file. Potentially fixable in the future.
-
class
hipercam.hlog.
Tseries
(t, y, ye=None, bmask=None, te=None, cpy=False)¶ Bases:
object
Class representing a basic time series with times, y values, y errors and flags, and allowing bad data. Attributes are:
t : ndarray mid-times y : ndarray y values ye : ndarray y errors bmask : ndarray bitmask propagated through from reduce log, that indicates possible problems affecting each data point. See core.py for the defined flags. te : None : ndarray Exposure times (not much is done with these, but sometimes it's good to have them on output. cpy : bool If True, copy the arrays by value, not reference.
Data can be bad, or it can be flagged, or it can be both. Some flags imply that the associated data will be bad, but there are some you may be able to live with. Bad data are indicated by any/all of t,y,ye being set = NaN. The bitmask values correspond to flags defined in hipercam.core. The bitmask values are OR-ed when an operation on two Tseries is performed. Thus the child of two Tseries inherits all the problems of each of its parents.