CubeData

class jwst.cube_build.cube_build.CubeData(input_models, par_filename, **pars)[source]

Bases: object

Hold top-level information on the IFU cube.

This class holds information on what type of cube is being created and how the cube is to be constructed, including:

  1. Bands covered by data (channel/sub-channel or filter/grating)

  2. If the IFU cube is a single or multiple band

  3. What instrument the data is for

  4. Weighting function to use to construct the IFU cube

Parameters:
input_modelslist

List of data models

par_filenamestr

Cube parameter reference filename

**parsdict

Holds top level cube parameters

Methods Summary

determine_band_coverage(master_table)

Determine which bands are covered by the cube.

number_cubes()

Determine the number of IFU cubes to create.

setup()

Set up IFU Cube, determine band coverage, and read in reference files.

Methods Documentation

determine_band_coverage(master_table)[source]

Determine which bands are covered by the cube.

To determine which bands are covered by the output cube:

  1. If MIRI data, then check if the user has set either the channel or band to use. If these have not been set, then read in the data to find out which bands the input data covered.

  2. If NIRSpec data, then check if the user has set the grating and filter to use. If these have not been set, then read in the data to find out which bands the input data covers.

Function to determine which files contain channels and subchannels are used in the creation of the cubes. For MIRI The channels to be used are set by the association and the subchannels are determined from the data.

Parameters:
master_tabledict

A dictionary for each band that contains of list of datamodels covering that band.

Raises:
NoChannelsError

The user selected channels are not in the data

NoSubChannelsError

The user selected subchannels are not in the data

NoGratingsError

The user selected gratings are not in the data

NoFiltersError

The user selected filters are not in the data

MissingParameterError

The user selected grating but not filter or vice versa

number_cubes()[source]

Determine the number of IFU cubes to create.

The number of cubes depends if the cube is created from a single band or multiple bands. In calwebb_spec2, 1 cube is created. If the data is MIRI MRS, then 2 channels worth of data is combined into one IFU cube. For calwebb_spec3 data, the default is to create multiple cubes containing single band data. However, the user can override this option and combine multiple bands in a single IFU cube.

Returns:
num_cubesint

Number of IFU cubes being created

cube_parslist

For each IFU cube, cube_pars holds 2 parameters. For MIRI data the parameters hold channel type and band type, while for NIRSpec data the pamaters hold grating type and filter type.

setup()[source]

Set up IFU Cube, determine band coverage, and read in reference files.

Read in the input_models and fill in the dictionary, master_table, that stores the data for each channel/subchannel or grating/filter. If the channel/subchannel or grating/filter are not set by the user, then determine which ones are found in the data

This routine fills in the instrument_info dictionary, which holds the default spatial and spectral size of the output cube, as well as, the region of influence size in the spatial and spectral dimensions. The dictionary master_table is also filled in. This dictionary contains list of datamodels for each band (channel/subchannel or grating/filter combination).

Returns:
instrumentstr

Instrument name, either “MIRI” or “NIRSpec”

instrument_infodict

Dictionary containing information on bands

master_tabledict

Dictionary containing files organized by type of data: instrument, channel/band or grating/filter