UCBerkeleySETI / meerkat-backend-interface

Breakthrough Listen's interface to MeerKAT
MIT License
0 stars 0 forks source link

Maintain canonicalized history of some metadata values #19

Closed david-macmahon closed 3 years ago

david-macmahon commented 4 years ago

Maintaining a history of key metadata values is useful for knowing which antennas have observed which sources and when. Two of the more critical metadata fields to memorialize this way are antennas and target. Unfortunately, there are several different ways to get at subtly different antennas and target metadata values. We need a way to canonicalize this.

An initial demonstration of how this historical data could be maintained has been setup to scrape the katcp and katportal log files on the head node to populate redis keys:

history:<array_name>:antennas
history:<array_name>:target

These redis keys refer to hashes whose fields are timestamps and whose values are strings. The timestamps represent UTC time and are formatted as:

YYYYmmddTHHMMSS.SSSZ

Where YYYY is the four digit year, mm is the month, dd is the day, T is literal 'T' to separate date and time, HH is the hour, MM is the minute, SS.SSS is the seconds to millisecond precision, and Z is a literal 'Z' to indicate UTC.

For strftime() implementations that support the %N conversion specification, the format string for this format this is %Y%m%dT%H%M%S.%3NZ. For strftime() implementations that lack %N support, the format string is %Y%m%dT%H%M%S.000Z. The latter form sets the milliseconds field to "000" for simplicity.

The values for the antennas fields are a JSON string that represents an ordered list of antenna names, such as:

["m001", "m002", "m003", "m004"]

Note that JSON require double quotes.

The values for the target fields are just the string taken directly from the sensor value.

One other point is that the keys for these history hashes need to be canonicalized. The current use of <array_name> (e.g. array_1) is derived from the name that our KATCP server gets from CAM. For the target name, however, the value has been taken from different sensors, some without the array name in their names. How to best canonicalize these is an open question. Additional details about available MeerKAT sensor values are needed to illuminate a path forward.

danielczech commented 4 years ago

The changes in commits 470ae05, cabcf82 and e935833 provide the above features; these will be tested during engineering time (hopefully today, 2020-05-28).

The target name is derived only from components explicitly part of the current subarray under consideration. Thus <array_name> always refers to the current subarray specifically.

Some thought may need to be given to circumstances in which antennas within the same subarray are pointed at different targets (if such circumstances are possible). Would this be the case in fly's eye mode observations, for example?

danielczech commented 4 years ago

The formatting is correct as of 470ae052, however we will wait for confirmation that we are using the best target sensor.

david-macmahon commented 3 years ago

This has been working for quite some time.