pynrc.simul.apt.ReadAPTXML¶
- class pynrc.simul.apt.ReadAPTXML[source]¶
Bases:
object
Class to open and parse XML files from APT. Can read templates for NircamImaging, NircamEngineeringImaging, WfscCommissioning, WfscGlobaLAlignment, WfscCoarsePhasing, WfscFinePhasing (incomplete), and NircamWfss modes.
- apt¶
APT namespace for XML files
- Type
str
- APTObservationParams¶
Dictionary of APT parameters that accumulates all parameters in all tiles and all observation. Passed out to be further parsed in the apt_inputs script
- Type
dict
- obs_tuple_list¶
Compiled list of all the parameters for all tiles in a single observation
- Type
list
Methods
__init__
()add_exposure
(dictionary, tup)Add an exposure to the exposure dictionary
Append exposure(s) information from a dictionary to an existing exposures dictionary
get_tracking_type
(observation)Determine whether the observation uses sidereal or non-sidereal tracking
read_coarsephasing_template
(template, ...)read_commissioning_template
(template, ...)read_finephasing_template
(template, ...)read_generic_imaging_template
(template, ...)Read imaging template content regardless of instrument.
read_globalalignment_template
(template, ...)read_miri_coronagraphy_template
(template, ...)Parse a MIRI coronagraphy observation template from an APT xml file.
read_nircam_coronagraphy_template
(template, ...)Parse a NIRCam coronagraphy observation template from an APT xml file.
read_nircam_grism_time_series
(template, ...)Parse a NIRCam Grism Time Series observation template from an APT xml file.
read_nircam_imaging_time_series
(template, ...)Parse a NIRCam Imaging Time Series observation template from an APT xml file.
read_nircam_wfss_template
(template, ...)Parse a NIRCam WFSS observation template from an APT xml file.
read_niriss_ami_template
(template, ...[, ...])Parse a NIRISS AMI observation template from an APT xml file.
read_niriss_wfss_template
(template, ...[, ...])Parse a NIRISS WFSS observation template from an APT xml file.
read_parallel_exposures
(obs, ...[, verbose])Read the exposures of the parallel instrument.
read_xml
(infile[, verbose])Main function.
separate_pupil_and_filter
(filter_string)Filters listed for NIRCam observations can take the form 'F164N+F444W' in cases where filters in the filter wheel and the pupil wheel are used in combination.
- add_exposure(dictionary, tup)[source]¶
Add an exposure to the exposure dictionary
- Parameters
dictionary (dict) – Information on individual exposures
tup (tuple) – A tuple contianing information to add to dictionary as the next exposure
- Returns
dictionary (dict) – With new exposure added
- append_to_exposures_dictionary(exp_dictionary, exposure_seq_dict, prop_param_dict)[source]¶
Append exposure(s) information from a dictionary to an existing exposures dictionary
- Parameters
exp_dictionary (dict) – Dictionary containing information on multiple exposures
exposure_seq_dict (dict) – Dictionary containing information on a single exposure. This dictionary should have the same keys as exp_dictionary. The contents of this dictionary will be added to exp_dictionary
prop_param_dict (dict) – A dictionary containing proposal-wide information, such as title and PI name
Reutrns
——-
exp_dictionary (dict) – With the new exposure(s) added
- get_tracking_type(observation)[source]¶
Determine whether the observation uses sidereal or non-sidereal tracking
- Parameters
observation (etree xml element) – xml content of observation
- Returns
tracking_type (str) – “sidereal” or “non-sidereal” based on the target used in the observation
- read_generic_imaging_template(template, template_name, obs, proposal_parameter_dictionary, verbose=False, parallel=False)[source]¶
Read imaging template content regardless of instrument.
Save content to object attributes. Support for coordinated parallels is included.
- Parameters
template (etree xml element) – xml content of template
template_name (str) – name of the template
obs (etree xml element) – xml content of observation
proposal_parameter_dictionary (dict) – Dictionary of proposal parameters to extract from template
- Returns
exposures_dictionary (OrderedDict) – Dictionary containing relevant exposure parameters
- read_miri_coronagraphy_template(template, template_name, obs, proposal_param_dict, parallel=False, verbose=False)[source]¶
Parse a MIRI coronagraphy observation template from an APT xml file. Produce an exposure dictionary that lists all exposures (excluding dithers) from the template.
- Parameters
template (lxml.etree._Element) – Template section from APT xml
template_name (str) – The type of template (e.g. ‘NirissAmi’)
obs (lxml.etree._Element) – Observation section from APT xml
proposal_param_dict (dict) – Dictionary of proposal level information from the xml file (e.g. PI, Science Category, etc)
parallel (bool) – If True, template should be for parallel observations. If False, NIRISS WFSS observation is assumed to be prime
- Returns
exposures_dictionary (dict) – Dictionary containing details on all exposures contained within the template. These details include things like filter, pupil, readout pattern, subarray, etc
exp_len (int) – Dictionary length to use when comparing to that from a parallel observation. This is not necessarily the same as the true length of the dictionary due to the way in which APT groups overvations
- read_nircam_coronagraphy_template(template, template_name, obs, proposal_param_dict, parallel=False, verbose=False)[source]¶
Parse a NIRCam coronagraphy observation template from an APT xml file. Produce an exposure dictionary that lists all exposures (excluding dithers) from the template.
- Parameters
template (lxml.etree._Element) – Template section from APT xml
template_name (str) – The type of template (e.g. ‘NirissAmi’)
obs (lxml.etree._Element) – Observation section from APT xml
proposal_param_dict (dict) – Dictionary of proposal level information from the xml file (e.g. PI, Science Category, etc)
parallel (bool) – If True, template should be for parallel observations. If False, NIRISS WFSS observation is assumed to be prime
- Returns
exposures_dictionary (dict) – Dictionary containing details on all exposures contained within the template. These details include things like filter, pupil, readout pattern, subarray, etc
exp_len (int) – Dictionary length to use when comparing to that from a parallel observation. This is not necessarily the same as the true length of the dictionary due to the way in which APT groups overvations
- read_nircam_grism_time_series(template, template_name, obs, proposal_parameter_dictionary)[source]¶
Parse a NIRCam Grism Time Series observation template from an APT xml file. Produce an exposure dictionary that lists all exposures (excluding dithers) from the template
- Parameters
template (lxml.etree._Element) – Template section from APT xml
template_name (str) – The type of template (e.g. ‘NirissWfss’)
obs (lxml.etree._Element) – Observation section from APT xml
proposal_param_dict (dict) – Dictionary of proposal level information from the xml file (e.g. PI, Science Category, etc)
- Returns
exposures_dictionary (dict) – Dictionary containing details on all exposures contained within the template. These details include things like filter, pupil, readout pattern, subarray, etc. Specifically for Grism Time Series, there will be entries for the TA exposure and the Time Series exposure.
- read_nircam_imaging_time_series(template, template_name, obs, proposal_parameter_dictionary)[source]¶
Parse a NIRCam Imaging Time Series observation template from an APT xml file. Produce an exposure dictionary that lists all exposures (excluding dithers) from the template
- Parameters
template (lxml.etree._Element) – Template section from APT xml
template_name (str) – The type of template (e.g. ‘NirissWfss’)
obs (lxml.etree._Element) – Observation section from APT xml
proposal_param_dict (dict) – Dictionary of proposal level information from the xml file (e.g. PI, Science Category, etc)
- Returns
exposures_dictionary (dict) – Dictionary containing details on all exposures contained within the template. These details include things like filter, pupil, readout pattern, subarray, etc. Specifically for Grism Time Series, there will be entries for the TA exposure and the Time Series exposure.
- read_nircam_wfss_template(template, template_name, obs, proposal_param_dict)[source]¶
Parse a NIRCam WFSS observation template from an APT xml file. Produce an exposure dictionary that lists all exposures (excluding dithers) from the template.
- Parameters
template (lxml.etree._Element) – Template section from APT xml
template_name (str) – The type of template (e.g. ‘NirissWfss’)
obs (lxml.etree._Element) – Observation section from APT xml
proposal_param_dict (dict) – Dictionary of proposal level information from the xml file (e.g. PI, Science Category, etc)
- Returns
exposures_dictionary (dict) – Dictionary containing details on all exposures contained within the template. These details include things like filter, pupil, readout pattern, subarray, etc
- read_niriss_ami_template(template, template_name, obs, proposal_param_dict, parallel=False, verbose=False)[source]¶
Parse a NIRISS AMI observation template from an APT xml file. Produce an exposure dictionary that lists all exposures (excluding dithers) from the template.
- Parameters
template (lxml.etree._Element) – Template section from APT xml
template_name (str) – The type of template (e.g. ‘NirissAmi’)
obs (lxml.etree._Element) – Observation section from APT xml
proposal_param_dict (dict) – Dictionary of proposal level information from the xml file (e.g. PI, Science Category, etc)
parallel (bool) – If True, template should be for parallel observations. If False, NIRISS WFSS observation is assumed to be prime
- Returns
exposures_dictionary (dict) – Dictionary containing details on all exposures contained within the template. These details include things like filter, pupil, readout pattern, subarray, etc
exp_len (int) – Dictionary length to use when comparing to that from a parallel observation. This is not necessarily the same as the true length of the dictionary due to the way in which APT groups overvations
- read_niriss_wfss_template(template, template_name, obs, proposal_param_dict, parallel=False, verbose=False)[source]¶
Parse a NIRISS WFSS observation template from an APT xml file. Produce an exposure dictionary that lists all exposures (excluding dithers) from the template.
- Parameters
template (lxml.etree._Element) – Template section from APT xml
template_name (str) – The type of template (e.g. ‘NirissWfss’)
obs (lxml.etree._Element) – Observation section from APT xml
proposal_param_dict (dict) – Dictionary of proposal level information from the xml file (e.g. PI, Science Category, etc)
parallel (bool) – If True, template should be for parallel observations. If False, NIRISS WFSS observation is assumed to be prime
- Returns
exposures_dictionary (dict) – Dictionary containing details on all exposures contained within the template. These details include things like filter, pupil, readout pattern, subarray, etc
exp_len (int) – Dictionary length to use when comparing to that from a parallel observation. This is not necessarily the same as the true length of the dictionary due to the way in which APT groups overvations
- read_parallel_exposures(obs, exposures_dictionary, proposal_parameter_dictionary, verbose=False)[source]¶
Read the exposures of the parallel instrument.
- Parameters
obs (APT xml element) – Observation section of xml file
exposures_dictionary (dict) – Exposures of the prime instrument
proposal_parameter_dictionary (dict) – Parameters to extract
verbose (bool) – Verbosity
- Returns
parallel_exposures_dictionary (dict) – Parallel exposures.
- read_xml(infile, verbose=False)[source]¶
Main function. Read in the .xml file from APT, and output dictionary of parameters.
- Parameters
infile (str) – Path to input .xml file
- Returns
dict – Dictionary with extracted observation parameters
- Raises
ValueError: – If an .xml file is provided that includes an APT template that is not supported. If the .xml file includes a fiducial pointing override with an unknown subarray specification
- separate_pupil_and_filter(filter_string)[source]¶
Filters listed for NIRCam observations can take the form ‘F164N+F444W’ in cases where filters in the filter wheel and the pupil wheel are used in combination. This function separates the two values.
- Parameters
filter_string (str) – Filter name as given in xml file from APT
- Returns
filter_name (str) – Name of the filter in the filter wheel
pupil_name (str) – Name of the filter in the pupil wheel