diff --git a/chimedb/data_index/__init__.py b/chimedb/data_index/__init__.py index b85f22a..e8a4804 100644 --- a/chimedb/data_index/__init__.py +++ b/chimedb/data_index/__init__.py @@ -24,6 +24,7 @@ RawadcFileInfo, StorageGroup, StorageNode, + TimingFileInfo, WeatherFileInfo, ) diff --git a/chimedb/data_index/orm.py b/chimedb/data_index/orm.py index 71788e7..d638988 100644 --- a/chimedb/data_index/orm.py +++ b/chimedb/data_index/orm.py @@ -94,6 +94,11 @@ def digitalgain(cls): """For getting the digitalgain acquisition type.""" return cls.from_name("digitalgain") + @classmethod + def timing(cls): + """For getting the timing acquisition type.""" + return cls.from_name("timing") + class ArchiveAcq(base_model): """Describe the acquisition. @@ -432,6 +437,24 @@ class CalibrationGainFileInfo(base_model): finish_time = pw.DoubleField(null=True) +class TimingFileInfo(base_model): + """Information about a timing data file. + + Attributes + ---------- + file : foreign key + Reference to the file this information is about. + start_time : float + Start of data in the file in UNIX time. + finish_time : float + End of data in the file in UNIX time. + """ + + file = pw.ForeignKeyField(ArchiveFile, backref="timinginfos") + start_time = pw.DoubleField(null=True) + finish_time = pw.DoubleField(null=True) + + class FlagInputFileInfo(base_model): """Information about a flag input data file. @@ -524,6 +547,7 @@ class MiscFileInfo(base_model): HKPFileInfo, DigitalGainFileInfo, CalibrationGainFileInfo, + TimingFileInfo, FlagInputFileInfo, MiscFileInfo, ] diff --git a/chimedb/data_index/util.py b/chimedb/data_index/util.py index 9e4974b..36fde60 100644 --- a/chimedb/data_index/util.py +++ b/chimedb/data_index/util.py @@ -112,6 +112,11 @@ def populate_types(): "name": "hfb", "notes": "21cm absorber (Hyper Fine Beam) data taken from a correlator.", }, + { + "id": 12, + "name": "timing", + "notes": "Timing correction from the calibration broker.", + }, ]: if not orm.AcqType.select().where(orm.AcqType.name == t["name"]).count(): orm.AcqType.insert(**t).execute()