JSON Schemas

Warning

Schemas are still work-in-progress and may change between OCM versions.

For a description of the style convention and how JSON structures are documented see section JSON Data Structures.

Common Definitions

Some parts are reusable in multiple commands and is presented here:

Download JSON Schema.

Start DAQ

Download JSON Schema.

This schema is a composite schema that defines the properties parameter that is provided for the StartDaq() command.

It is foreseen that all parameters to StartDaq() will be provided as part of the following structure, in a future version of OCM.

Note

All time durations are specified in seconds.

Example:

{
  "awaitInterval": 5.0,
  "keywords": [
    {
      "type": "valueKeyword",
      "name": "OBJECT",
      "value": "OBJECT,SKY"
    },
    {
      "type": "esoKeyword",
      "name": "OBS TPLNO",
      "value": 2
    }
  ]
}

Root object description:

awaitInterval (Optional[float]) [default: 5.0]

This is the interval and maximum duration, in (fractional) seconds, used when awaiting the completion of primary sources. If this number exceed the MAL timeout it will stop working.

This is not a polling interval where shorter time will be more responsive. If await condition is fulfilled the reply will be sent immediately.

keywords (Optional[List[FitsKeyword]]) [default: []]

These are the initial FITS keywords that will eventually be provided with the FITS file created by OCM primary HDU. See FITS Keywords for detail.

FITS Keywords

Download JSON Schema or view it here.

FITS keywords are provided as a JSON-array of FitsKeyword objects, where each object describe one keyword. The following example show one FITS standard value keyword and one ESO hierarchical keyword:

[
   {
      "type":"valueKeyword",
      "name":"OBJECT",
      "value":"OBJECT,SKY"
   },
   {
      "type":"esoKeyword",
      "name":"OBS TPLNO",
      "value":2
   }
]
FitsKeyword (Union[ValueKeyword, EsoKeyword, LiteralKeyword])

This object represent any valid FITS keyword.

ValueKeyword (object)

This object represents a FITS value keyword.

type (“valueKeyword”)

This is a union discriminator and must have the literal string value "valueKeyword".

name (str)

Logical Keyword Name (up to 8 characters).

Examples:

  • RA

  • DEC

  • OBJECT

value (Union[str, boolean, number])

For both valueKeyword and esoKeyword the value field provide the typed keyword value. See JSON to FITS type conversion for mapping between JSON and FITS.

comment (Optional[str])

Optional comment.

EsoKeyword (object)

This object represents a HIERARCH ESO FITS keyword [ RD6].

type (“esoKeyword”)

This is a union discriminator and must have the literal string value "esoKeyword".

name (str)

Logical Keyword Name which does not include the HIERARCH ESO prefix.

Examples:

  • DET CHIP GAIN

  • TEL AIRM START

  • ADA GUID RA

value (Union[str, boolean, number])

For both valueKeyword and esoKeyword the value field provide the typed keyword value. See JSON to FITS type conversion for mapping between JSON and FITS.

comment (Optional[str])

Optional comment.

LiteralKeyword (object)

This object represents a fully formatted FITS keyword record.

type (“literalKeyword”)

This is a union discriminator and must have the literal string value "literalKeyword".

value (str)

Fully formatted FITS keyword record with optional trailing spaces.

Table 6 JSON to FITS type conversion

JSON

FITS

Notes

Example

string

string

Do not use single-qotes '.

Timepoints are represented as strings.

"foobar" -> 'foobar', "2020-07-28T04:57:00.8836" -> '2020-07-28T04:57:00.8836'

boolean

logical

true -> T, false -> F

number

integer or float

Dictionary will be used to format the value correctly (not yet implemented).

integer range: -9223372036854775807 .. 9223372036854775807

float range: -1.79769313486231e+308 .. 1.79769313486231e+308

Note

There is no built-in type in either JSON or FITS to represent a time point (date/datetime). DICD [RD1] standard time format is ISO 8601: YYYY-MM-DDThh:mm:ss.sss or YYYY-MM-DD when only date is shown.

When it is time to format the value a dictionary will be used to validate the keyword and perform the formatting of the raw value as well as to provide the comment field (see ctd project for additional details on the dictionary system).

Standard MAL API

Note

daqOcmServer hosts the standard commands stdif.StdCmds under URI path /std.

The standard interface is documented in the RAD User Manual and should be consulted for details and only the brief is provided here.

Interfaces

class stdif.StdCmds

Standard command interface.

Stop() → str
Init() → str
Reset() → str
Enable() → str
Disable() → str
GetState() → str
GetStatus() → str
GetVersion() → str
Exit() → str
SetLogLevel(info: LogInfo) → str

Data Structures

class stdif.LogInfo
level: str
logger: str
class stdif.Status
status: str
source: str