OB Creation#

p2obt supports various ways of local or online (on P2) ob creation. In addition to a single ob creating script (OB Creation), there is a fully automated pipeline that can make multiple obs at once (OB Creation Pipeline).

OB Creation#

This is meant to give some examples on how to use the create_ob for singular ob creation.

A full example script can be found in examples/create_ob.

One can either locally create an (.obx)-file (see Local Creation) or directly upload the content of a dictionary to the P2 environment (see Direct Upload).

Local Creation#

Note

To locally create a science target (.obx)-file a Path or str must be provided for the ouput_dir keyword.

In the following an an (.obx)-file for a science target for GRA4MAT setting will be created for the UTs.

create_ob("HD 142666", "sci", "uts",
          operational_mode="gr", output_dir=output_dir)

Similarly, for a calibrator an (.obx)-file for the UT-array configuration for the science target "HD 142666" and for GRA4MAT, tagged as an L band calibrator can be created like this.

create_ob("HD 100920", "cal", "uts",
          sci_name="HD 142666", tag="L",
          operational_mode="gr", output_dir=output_dir)

Direct Upload#

A direct upload to the P2 environment is also possible.

Note

For this the container_id keyword must be provided.

Then the dictionary created will be directly uploaded and if the connection-keyword is :python:`None it will ask for your login data otherwise it will directly connect.

Now an ob for the target "HD 100920" as a calibrator for the science target "HD 142666 will be directly created on the P2.

create_ob("HD 100920", "cal", "uts",
          sci_name="HD 142666", operational_mode="gr",
          container_id=3001786, server="demo", password="52052")

Note

For this example the ob will be uploaded to ESO’s demo environment (https://www.eso.org/p2demo/home) to the subfolder p2obt of the run 60.A-9252(N) MATISSE.

OB Creation Pipeline#

This is meant to give an example on how to use the fully automated pipeline, create_obs, of p2obt for ob-creation. The full example script can be found in examples/create_obs.

Manual Creation#

Now follows a step-by step guide for the usage of the script with manual input.

For the manual input, the user needs to specify multiple lists. A science_targets list is always required and optionally a calibrators list can be given. The science targets will be then assigned to the calibrators and one science target can have multiple calibrators (in a one level nested list).

science_targets = ["Beta Leo", "HD 100453"]
calibrators = [["HD100920", "HD173460"], "HD102964"]

Note

There are two additional lists that can be specified. The orders lists specifies the order of the targets after upload, where "b" stands for before and "a" for after the science target. This results in either SCI-CAL, CAL-SCI-CAL or any combination.

The other list that can be given is the tags list, that specifies the calibrators’ tags. The tags are ‘L’ for an L-band calibrator, ‘N’ for an N-band calibrator and “LN” for both bands. The default is “LN” for both.

If the orders and tags lists are not provided by the user, they will be autofilled to have the same shape as the calibrators list.

orders = [["b", "a"], "a"]
tags = [["L", "LN"], "N"]

These lists then need to be passed as a combined list manual_input to the function:

manual_input = [sci_lst, cal_lst, tag_lst, order_lst]

Note

With the resolutions dictionary, one can manually set the resolution for specific targets as keys, with the resolution as values (either low, med or high).

resolution = {"Beta Leo": "med"}

Warning

The global resolution as well as the resolution dictionary will be overwritten if a local catalog is activated/queried and contains the target.

To avoid this set the overwrite option OPTIONS.resolution.overwrite to True.

For more information see options

The operational mode (either "gr" for GRA4MAT or "st" for MATISSE-standalone specifies the obs’ settings). This will either upload the obs to a the specified container (keyword container_id on p2)

create_obs(manual_lst=manual_lst, operational_mode="both",
           resolution=resolution, container_id=3001786,
           server="demo", password="52052")

or make them locally as (.obx)-files, if an output_dir is specified.

create_obs(manual_lst=manual_lst, operational_mode="both",
           resolution=res_dict, output_dir=output_dir)

Note

For this example the ob will be uploaded to ESO’s demo environment (https://www.eso.org/p2demo/home) to the subfolder p2obt/ of the run 60.A-9252(N) MATISSE.

Night Plan Based Creation#

In addition to the manual creation, there is also a more automated way - The core aspect of p2obt - the night plan parsing, automatic ob creation and upload.

Note

For the specifics on the parser and examples for night plans see Features - Night Plan Parsing.

After a night plan has been provided, the parse_night_plan function will parse this into chuncks of runs that have subsections for nights and in those some sort of science target and calibrator(s) arrangements.

The code to create the (.obx)-files locally, is similar to before

create_obs(night_plan=night_plan,
           resolution=res_dict, output_dir=output_dir)

Note

The parser, if the guidelines in Features - Night Plan Parsing for the night plan are taken care of, can automatically determine the run_id, which is a run’s container_id, the array_configuration, the standard resolution OPTIONS.resolution.active as well as the operational_mode.

If any of these cannot be automatically determined, the parser will prompt the user for each detected run and every not detected keyword.

One can also directly provide a container_id, then the automatically created obs will be uploaded to this container instead and possible run_id’s will be ignored.

Additionally, specifying an output_dir will always overwrite the online creation.

and similarly for uploading the obs directly just omit the output_dir.

create_obs(night_plan=night_plan, resolution=resolutions)