calibration_lamp_high_resolution

This module’s scope are the operations required to reduce data from a high resolution spectrograph.

Example:

>>> import tuna
>>> file_object = tuna.io.read ( "tuna/test/unit/unit_io/adhoc.ad3" )
>>> reducer = tuna.pipelines.calibration_lamp_high_resolution.reducer (             calibration_wavelength = 6598.953125,             finesse = 12,             free_spectral_range = 8.36522123894,             interference_order = 791,             interference_reference_wavelength = 6562.7797852,             pixel_size = 9,             scanning_wavelength = 6616.89,             tuna_can = file_object,             channel_subset = [ 0, 1, 2, 5 ],             continuum_to_FSR_ratio = 0.125,             min_rings = 2,             noise_mask_radius = 8,             dont_fit = False,             unwrapped_only = False,             verify_center = None ); reducer.join ( )
>>> reducer.wavelength_calibrated.array [ 10 ] [ 10 ]
31.187012437244345
tuna.pipelines.calibration_lamp_high_resolution.pixel_profiler(reducer, pixel)[source]

This function’s goal is to conveniently return a structure containing the data for a given “position” throughout the pipeline. Since objects can have 2 or 3 dimensions, the data structure returns either a value or a 1 dimensional array for each product.

Parameters:

  • reducer : reference to a calibration_lamp_high_resolution object

    Should be set to the (already run) pipeline.

  • pixel : tuple of 2 integers

    Containing the values for column and row of the point to be investigated.

Returns a dictionary with 8 fields (each field corresponds to the result of a method of the calibration_lamp_high_resolution class):

  • ‘Original data’ : numpy.ndarray

    Contains the spectrum for the input pixel.

  • ‘Discontinuum’ : numpy.ndarray

    The value of the continuum for the input pixel.

  • ‘wrapped phase map’ : float

    The value of the wrapped phase map at the input pixel.

  • ‘Order map’ : float

    The order to which the pixel belongs to (relative to the order at the center of the ring structure).

  • ‘Unwrapped phase map’ : float

    The value of the unwrapped phase map at the input pixel.

  • ‘Parabolic fit’ : float

    The value of the fitted parabolic model at the input pixel.

  • ‘Airy fit’ : numpy.ndarray

    The value of the fitted Airy model at the input pixel.

  • ‘Wavelength’ : float

    The value of the wavelength-calibrated map at the input pixel.

class tuna.pipelines.calibration_lamp_high_resolution.reducer(best_ring_plane: int=None, calibration_wavelength: float=0, channel_subset=[], continuum_to_FSR_ratio=0.125, dont_fit=False, finesse: float=1, free_spectral_range: float=1, interference_order: int=1, interference_reference_wavelength: float=0, min_rings=1, noise_mask_radius=1, noise_threshold=None, overscan_removal={}, parameter_file: str='', pixel_size: float=1, plot_log=False, ring_minimal_percentile=None, scanning_wavelength: float=0, tuna_can: tuna.io.can.can=None, unwrapped_only=False, verify_center=None)[source]

Creates and stores an unwrapped phase map, taking as input a raw data cube.

It inherits from the threading.Thread class, and it auto-starts its thread execution. Clients are expected to use its .join ( ) method before using its results.

Intermediary products are:

  • continuum
  • discontinuum
  • wrapped_phase_map
  • noise
  • borders_to_center_distances
  • order_map
  • unwrapped_phase_map
  • parabolic_fit
  • airy_fit
  • airy_fit_residue
  • substituted_channels
  • wavelength_calibrated

Its constructor parameters are:

  • best_ring_plane : integer : 0

    This optional parameter, when specified, will limit the search for the ring structure to the specified plane. Note that the first plane on a cube has index 0.

  • calibration_wavelength : float : 0

    Encodes the magnitude of the calibration wavelength, in Angstroms.

  • channel_subset : list of integers : [ ]

    A list of the channels to be substituted by their fitted model’s data.

  • continuum_to_FSR_ratio : float : 0.5

    The ratio between the number of channels expected to have a continuum-dominated signal, and the channels expected to have a line-dominated signal. This is used to produce a continuum map; larger ratios means more data belongs to the continuum.

  • dont_fit : bool : False

    Specifies whether to fit models to the data.

  • finesse : float : 1

    Containing the value of the Finesse for this spectrographer.

  • free_spectral_range : float : 1

    Containing the value in Angstroms for the bandwidth that corresponds to one interference order.

  • interference_order : integer : 1

    The order of the interference pattern from the spectrograph for this wavelength, and étalon separation.

  • interference_reference_wavelength : float : 0

    The order of the interference pattern for the reference wavelength.

  • min_rings : integer : 1

    The number of rings present in the data cube.

  • noise_mask_radius : integer : 1

    The distance from a noise pixel that will be marked as noise also (size of a circle around each noise pixel);

  • noise_threshold : float : None

    The minimal value for a pixel content to be marked as signal, instead of noise. If None, this value will be automatically computed.

  • overscan_removal : dict : { }

    A dictionary of elements that must be removed from the datacube.

  • parameter_file : str : “”

    The path for a text file containing the values for the other parameters needed for this pipeline. The format must be: parameter = value

  • pixel_size : float : 1

    The size in micrometers of the separation between each pixel center in the CCD.

  • plot_log : boolean : False

    Specifies whether to matplotlib plot the partial results (which will be always available as ndarrays).

  • ring_minimal_percentile : integer : None

    The value for the minimal percentile that contains some data on the dataset. If None, will be determined automatically.

  • scanning_wavelength : float : 0

    The value in Angstroms for the wavelength used for scanning.

  • tuna_can : can : None

    The raw interferograph data. Must be a can object.

  • unwrapped_only : boolean : False

    If True, will avoid computing the model fits and the wavelength calibration.

  • verify_center : tuple of 2 integers : None

    If not None, the center calculated by the pipeline will be validated against the input value.

create_unwrapped_phase_map()[source]

Unwraps the phase map according using the order array constructed.

run()[source]

threading method for starting execution.

verify_parabolic_model()[source]

Since the parabolic model fits a second-degree equation in two variables to the data, which we expect to have a circular symmetry, the coefficients for each second-degree element in the fitted equation should be “close”. This can be quantified as the ratio between these coefficients, which this method prints on the log.