Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ss/timing rt update #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chimedb/data_index/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
RawadcFileInfo,
StorageGroup,
StorageNode,
TimingFileInfo,
WeatherFileInfo,
)

Expand Down
24 changes: 24 additions & 0 deletions chimedb/data_index/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -524,6 +547,7 @@ class MiscFileInfo(base_model):
HKPFileInfo,
DigitalGainFileInfo,
CalibrationGainFileInfo,
TimingFileInfo,
FlagInputFileInfo,
MiscFileInfo,
]
Expand Down
5 changes: 5 additions & 0 deletions chimedb/data_index/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down