Recorders
- We support the following recorders beside the parent class Recorder:
SSDRecorder (Pulse data)
SSDParser (Pulse data read in chunks)
PMTRecorder (Pulse data)
FileRecorder (Finds files)
FileParser (Finds files and reads in chunks)
ImageFileRecorder (Finds image files and their metadata)
CoilRecorder (Records the coil)
IonRecorder (Records the Ionizer)
LaserRecorder (Records the laser frequencies)
GaugeRecorder (…)
HeaterRecorder (Records the heating of Yttrium foil
CycleRecorder (Records the analyses results)
ParameterRecorder (Records the parameters used in the analysis)
SSDResultsRecorder (Records the result of the SSDAnalysis)
StaticRecorder (Turns a pandas dataframe into a Recorder)
- class data_eng_utokyo.recorders.Recorder(filepath: str, has_metadata: bool = True, delimiter: str = ',', always_update: bool = False, encoding='utf-8')[source]
Bases:
objectBase class for mapping a csv file to a pandas dataframe in real-time.
- Parameters:
filepath (str) – Full path to the csv file.
has_metadata (bool) – Whether or not the csv file has metdata.
delimiter (str) – Delimiter used in the csv file.
always_update (bool) – Should the loading of new data be forced.
encoding (str) – Encoding used in the csv file.
- get_table() DataFrame[source]
Get the full table consisting of data and metdata.
- Returns:
Pandas dataframe.
- Return type:
DataFrame
- get_metadata() DataFrame[source]
Get just the metadata
- Returns:
Pandas dataframe.
- Return type:
DataFrame
- is_up_to_date() bool[source]
Returns true if the csv has not been modified since the last loading.
- Returns:
bool
- Return type:
bool
- _update_data()[source]
Updates self._data_df and self.data_last_updated incrementally.
Note
Makes use of _load_new_data().
- _timestamp_to_datetimes(df: DataFrame)[source]
Takes a dataframe with a timestamp column (int) and adds datetime.
- Parameters:
df (pd.DataFrame) – Datarame which should be manipulated.
- abstract _load_initial_data() DataFrame[source]
Returns all data up to now and defines the data columns.
- Returns:
Pandas dataframe.
- Return type:
DataFrame
- abstract _load_new_data() DataFrame[source]
Gets the rows which have not been loaded so far.
- Returns:
Pandas dataframe.
- Return type:
DataFrame
- class data_eng_utokyo.recorders.SSDRecorder(filepath: str, always_update: bool = False, lines_per_update: int = 100000.0)[source]
Bases:
RecorderRecords all the SSD2 data at once.
Note
- In most cases, there is too much data incoming at once. In this case, we recommend to use the SSDParser, which
reads the data in chunks.
- Parameters:
filepath (str)
always_update (bool)
lines_per_update (int)
- class data_eng_utokyo.recorders.SSDParser(filepath: str, always_update: bool = False, lines_per_update: int = 100000.0)[source]
Bases:
SSDRecorderRecords the SSD data in chunks.
Acts as a parser in the sense that it forgets about the old data upon reloading. This keeps the table size small.
- Parameters:
filepath (str)
always_update (bool)
lines_per_update (int)
- class data_eng_utokyo.recorders.PMTRecorder(filepath: str, has_metadata: bool = False, always_update: bool = False)[source]
Bases:
Recorder- Parameters:
filepath (str)
has_metadata (bool)
always_update (bool)
- class data_eng_utokyo.recorders.FileRecorder(filepath: str, always_update: bool = False, match: str = '')[source]
Bases:
RecorderTracks the filenames which match a format in a specific folder.
- Parameters:
filepath (str) – Path to the folder in which the files are stored.
always_update (bool) – Should the recorder always check for new data.
match (str) – Regex with which the filenames are compared. Only matching strings are tracked.
- match[source]
Regex with which the filenames are compared. Only matching strings are tracked.
- Type:
str
- _load_initial_data() DataFrame[source]
Gets all data (filepath and metadata of images).
- Returns:
Data as a pandas dataframe.
- Return type:
DataFrame
- _load_new_data() DataFrame[source]
Gets all data (filepath and metadata of images) which are new.
- Returns:
New data as a pandas dataframe.
- Return type:
DataFrame
- class data_eng_utokyo.recorders.FileParser(filepath: str, always_update: bool = False, match: str = '')[source]
Bases:
FileRecorderWorks like the FileRecorder, but just returns new data each time.
Note
The parser forgets the old data and just returns the new one. It is convenient when we want to laod many files in chunks. We can just call the FileParser multiple times, and each time it tells us which files we should load.
- Parameters:
filepath (str) – Path to the folder in which the files are stored.
always_update (bool) – Should the recorder always check for new data.
match (str) – Regex with which the filenames are compared. Only matching strings are tracked.
- class data_eng_utokyo.recorders.ImageFileRecorder(filepath: str, always_update: bool = False, match: str = '')[source]
Bases:
RecorderVariation of the FileRecorder which works online of Google Colab. It just works for camera images (.csv), because they contain a metadata file (all_data.csv) in the next-higher folder. This metadata file allows us to read of the timestamp.
- Parameters:
filepath (str)
always_update (bool)
match (str)
- _load_initial_data() DataFrame[source]
Returns all data (filepath and metadata of images) which are new.
- Return type:
DataFrame
- class data_eng_utokyo.recorders.CoilRecorder(filepath: str, always_update: bool = False)[source]
Bases:
RecorderTracks the whether the current of the MOT coil is on or off.
- Parameters:
filepath (str) – Path to the text file.
always_update (bool)
- class data_eng_utokyo.recorders.IonRecorder(filepath: str, always_update: bool = False)[source]
Bases:
Recorder- Parameters:
filepath (str)
always_update (bool)
- class data_eng_utokyo.recorders.LaserRecorder(filepath: str, always_update: bool = False)[source]
Bases:
Recorder- Parameters:
filepath (str)
always_update (bool)
- _aggregate_laser_rows(original_df: DataFrame)[source]
Originally, one measurement of the six laser wavelengths is distributed over six rows. We aggregate these rows into one row. The only tradeoff is that we have to approximate the time with the time of the last measurement.
- Parameters:
original_df (DataFrame)
- class data_eng_utokyo.recorders.GaugeRecorder(filepath: str, always_update: bool = False)[source]
Bases:
RecorderTracks the Rb dispenser and the neutralizer current.
- Parameters:
filepath (str)
always_update (bool)
- class data_eng_utokyo.recorders.HeaterRecorder(filepath: str, always_update: bool = False)[source]
Bases:
RecorderClass for data engineering of the heater data.
- Parameters:
filepath (str)
always_update (bool)
- class data_eng_utokyo.recorders.CycleRecorder(filepath: str, has_metadata: bool = True, delimiter: str = ',', always_update: bool = False, encoding='utf-8')[source]
Bases:
RecorderTracks all results and combines them into one dataframe.
- Parameters:
filepath (str)
has_metadata (bool)
delimiter (str)
always_update (bool)
- class data_eng_utokyo.recorders.ParameterRecorder(filepath: str, always_update: bool = False)[source]
Bases:
RecorderTracks the parameter settings of each cycle.
- Parameters:
filepath (str)
always_update (bool)
- class data_eng_utokyo.recorders.SSDResultsRecorder(filepath: str, always_update: bool = False)[source]
Bases:
RecorderTracks the result file of the SSD Analysis.
- Parameters:
filepath (str)
always_update (bool)