SPICE_DATA::create_l3_file - ITA-Solar/solo-spice-ql GitHub Wiki
Source code: SPICE_DATA::create_l3_file
Class: SPICE_DATA
Description
This routine creates a level 3 FITS file for the chosen window(s). If the window is a Dumbbell or an Intensity-window no fits are made. The data is arranged so that cfit_block can read it. The routine either estimates the positions of the main peaks or uses a line list to define the peaks and fits those to the data by calling cfit_block. This may take a while. After that, the xcfit_block routine is called with the data and the fit, where one can view the result and make adjustments to the fit. After exiting xcfit_block by using the 'Exit' button, the routine saves the fits into a level 3 FITS file and moves this file into the $SPICE_DATA/user/level3/ directory. The resulting file will by default contain only one extension per window, the RESULTS extension. The DATA is linked to the level 2 file as an external extension. RESIDUALS and LAMBDA can be reconstructed when reading the file, and WEIGHTS, INCLUDE and CONSTANT are only saved if they contain non-default values.
Syntax
l3_filename = spice_object->create_l3_file( [window] [, /no_masking] [, /approximated_slit]
[, /no_fitting] [, /no_widget] [, /no_xcfit_block] [, /position] [, velocity=velocity]
[, /no_line_list] [, force_version=force_version]
[, top_dir=top_dir] [, path_index=path_index] [, /save_not]
[, all_ana=all_ana] [, all_result_headers=all_result_headers] [, all_data_headers=all_data_headers]
[, all_proc_steps=all_proc_steps]
[, /SAVE_XDIM1] [, /PRINT_HEADERS]
[, progress_widget=progress_widget]
[, group_leader=group_leader] [, pipeline_dir=pipeline_dir] [, /quiet] )
Return Value
The path and name of the Level 3 FITS file. And a level 3 FITS file, saved to directory $SPICE_DATA/user/level3/ .
Arguments
window
A scalar or an array of integers or strings, giving the indices or names of the window(s) to be analysed. Default is all windows if this is input is not provided.
Optional inputs
VELOCITY
Set this equal to the initial velocity if you want the line position represented by the velocity relative to a lab wavelength - the lab wavelength is taken from the supplied POSITION, i.e., INT_POS_FWHM(1), which is calculated/estimated within the procedure 'generate_adef'. This input is ignored if /POSITION is set. Default is zero.
TOP_DIR
A path to a directory in which the file should be saved. The necessary subdirectories will be created (e.g. level2/2020/06/21).
PATH_INDEX
If $SPICE_DATA contains multiple paths, then this keyword allows you to specify to which path you send the file. Default is 0.
progress_widget
An object of type SPICE_CREATE_L3_PROGRESS, to display the progress of the creation.
group_leader
Widget ID of parent widget.
force_version
The version number (integer) the level 3 file must have.
pipeline_dir
The path to the output directory used by the pipeline where L3 file is saved.
Keywords
no_masking
If set, then SPICE_DATA::mask_regions_outside_slit will NOT be called on the data. This procedure masks any y regions in a narrow slit data cube that don't contain slit data, i.e. pixels with contributions from parts of the detector that lie above/below the dumbbells, in the gap between the slit ends and the dumbbells, and the dumbbell regions themselves. The masking procedure is not called for wide-slit observations or if window_index corresponds to a regular dumbbell extension.
approximated_slit
If set, routine uses a fixed (conservative) value for the slit range, i.e. does not estimate the slit length based on the position of the dumbbells.
no_fitting
If set, fitting won't be computed. This can still be done manually in xcfit_block.
no_widget
If set, xcfit_block and small window to stopp fitting will not be called.
no_xcfit_block
If set, xcfit_block will not be called, but small window to stopp fitting will appear.
position
If set, then the line position is NOT represented by the velocity relative to a lab wavelength, but as the wavelength.
no_line_list
If set, then no predefined line list will be used to define gaussian fit components. By default, the list returned by the function spice_line_list() will be used.
IMPORTANT NOTE: For now, this keyword is set by default. One has to set it explicitly to zero if one wants to use the predefined line list. This implementation may change in the future.
Due to instrument temperature variations the wavelength scale changes significantly during the Solar Orbiter orbit, and this variation is not accounted for in L2 files. The wavelength shift is so large that using the line list when fitting fails in many cases.
SAVE_XDIM1
If set, then the XDIM1 cube will be saved into the FITS file. Default is not to save it. This cube can be recalculated using the WCS parameters given either in HEADER_INPUT_DATA. This keyword can also be an array of zeros and ones, setting/unsetting this feature separately for each window.
PRINT_HEADERS
If set, then all headers created will be printed to the terminal.
save_not
If set, then the FITS file will not be saved. The output is the path and name of the level 3 FITS file, if it would have been saved.
quiet
If set, print messages will be suppressed.
OPTIONAL OUTPUTS:
all_ana
Array of ana structure, number of elements is the same as number of windows in the FITS file.
all_result_headers
A pointer array, containing the headers of the results extensions as string arrays.