SPICE_DATA::mask_regions_outside_slit - ITA-Solar/solo-spice-ql GitHub Wiki

Source code: SPICE_DATA::mask_regions_outside_slit

Class: SPICE_DATA

Description

Returns the input data array with any pixels that are above or below the narrow slit region set to NaN. This method is called when SPICE_DATA::get_window_data is called if the no_masking keyword is NOT set.

And now a little background story: The height of the 2",4" and 6" slits is 600 pixels. At both ends of the slits there is a ~48 y-pixel gap with no throughput, then a dumbbell region of ~32 y-pixels.

A standard readout window was originally planned to include only the 600 pixels of the slit region (or a sub-range of pixels in this region), and optionally one or both dumbbells for a single of these windows.

However, the spectra turned out to be tilted on the detectors, the tilt angles are not the same on the detetors, and the spectra of the two detetors are displaced in the y direction relative to one another. In order to ensure that the windows contain the full slit on both detectors the new default window height is therefore 768 pixels. The result is that all narrow slit windows on the SW detector will contain the full upper dumbbell and the LW windows will contain the full lower dumbbell.

The L1 to L2 calibration includes a geometrical correction of tilts, slants, rotations and displacements. In theory the dumbbells should fall on the same pixels in every observation and it should be easy to mask them. However, the spectra for a given detector may be shifted +/- 10 pixels or so from one observation to another. The shift probably happens when the slit is changed but it's not fully understood.

Therefore, we need to determine where the y slit range based on the observational data. It's hard to set up fool proof criteria for determining the slit edges based on the signal from the slit itself, since the signal often is very weak. The dumbbell signal on the other hand is normally much stronger. Therefore, the help methods of this method determine the slit y range by first estimating the locations of the dumbbell regions:

  1. For each detector, make a 1D array containg the intensity along the y direction [::get_y_intensity_both_detectors]
  2. Smooth the y intensity arrays heavily in order to estimate the midpoint of the dumbbell (i.e. the upper dumbbell for the SW y intensity array, the lower dummbell for the LW y array). Special care is taken if the dumbbells are not present in the data cube due to a non-standard window height, or if one (or both) of the dumbbells can't be identified (typically if a dumbbell falls off-limb). [::get_dumbbell_max_ix]
  3. Take the approximate number of pixels between the dumbbell midpoints and slit edges into account when estimating the slit y range [::get_slit_edge] 5: Set all pixels in the data cube that are below or above the slit y range to NaN

Syntax

data = spice_object->mask_regions_outside_slit( data, window_index [, /approximated_slit] [, /debug_plot] )

Return Value

Returns the data cube that was given as input, but with any pixels below or above the narrow slit set to NaN.

Arguments

data

A 4D data cube returned by SPICE_DATA::get_window_data

window_index

The index of the desired window.

Keywords

approximated_slit

if set, a default value of the dumbbell midpoint is used instead of trying to estimating the midpoint. To be on the safe side a few pixels are added (upper dumbbell) or subtracted (lower dumbbell) from the estimated midpoint to make sure that no slit data is masked in the case of an unusually low or high placement of the spectra.

debug_plot

If set, make plots to illustrate which part of the window is being masked. This keyword is ignored if NO_MASKING is set.

SIDE EFFECTS

If approximated_slit is not set, then ::get_window_data() will be called for all windows in the file once. The structure tag self.slit_y_range will be set the first time this method is called. A later call of this method will use the value of self.slit_y_range.