spice_xcit_block_plan - ITA-Solar/solo-spice-ql GitHub Wiki

SPICE_XCFIT_BLOCK Plan

All the latest code for these examples and tests are in the branch 'mwiesman/xcfit'.

SPICE_XCFIT_BLOCK can be called via the SPICE_DATA method xcfit_block

spice_level2_file = getenv('SPICE_DATA') + '/level2/2021/03/22/solo_L2_spice-n-ras_20210322T112721_V05_50331869-001.fits'
obj = spice_object(spice_level2_file)
window_index = 0
ana = obj->xcfit_block(window_index)

or soon via a button in the widget 'SPICE_XCONTROL' see here for method code

Input used so far

  • Lambda:
lambda = self->get_wcs_coord(window_index, /lambda)
lambda = transpose(lambda, [2, 0, 1, 3])

this SPICE_DATA method uses 'wcs_get_coord' and 'fitshead2wcs' from solarsoft.

  • Data:
data = self->get_window_data(window_index, /load)
data = transpose(data, [2, 0, 1, 3])
  • Missing:
miss = self->get_missing_value()

this is taken from the keyword 'BLANK' or else NAN (I think NAN causes problems in cfit).

  • Weights:
weights = make_array(size_data[3], size_data[1], size_data[2], size_data[4], value=1.0)

FIT input

The FIT parameter is so far not provided, and thus xcfit_block adds the default background fit only. But this is not what we want, and I guess that we want some default fit curves here as input.

  • Where should these fit curves come from?
  • These would need to be specific to the wavelength range of the input window, right?

Discussion

When exiting xcfit_block

When user exits the xcfit_block widget (with or without saving ana file), the program returns to xcfit_block method of SPICE_DATA object. And there I'll get the updated ana structure (with handles).

  • lambda (unchanged)
  • data (unchanged)
  • weights (possibly changed)
  • fit (possibly changed)
  • miss (unchanged)
  • result (populated/changed)
  • residual (populated/changed)
  • include (populated/changed)
  • const (populated/changed)
  • history (string array)
  • filename (string)
  • datasource (string)
  • definition (string)
  • label (string)
  • origin (?) (undefined in example eis file)
  • scale (?) (undefined in example eis file)
  • phys_scale (?) (undefined in example eis file)
  • dimnames (?) (undefined in example eis file)

What do I do with these data?

Discussion

  • As of now, the SPICE_DATA method returns an ana structure:
** Structure CFIT_ANALYSIS, 18 tags, length=128, data length=124:
   FILENAME        STRING    ''
   DATASOURCE      STRING    ''
   DEFINITION      STRING    ''
   LABEL           STRING    ''
   HISTORY_H       LONG                 1
   LAMBDA_H        LONG                 2
   DATA_H          LONG                 3
   WEIGHTS_H       LONG                 4
   FIT_H           LONG                 5
   MISSING         DOUBLE                 NaN
   RESULT_H        LONG                 6
   RESIDUAL_H      LONG                 7
   INCLUDE_H       LONG                 8
   CONST_H         LONG                 9
   ORIGIN_H        LONG                10
   SCALE_H         LONG                11
   PHYS_SCALE_H    LONG                12
   DIMNAMES_H      LONG                13
  • Eventually, we want to be able to save ana as a FITS file, correct?
  • Should that be done automatically, i.e. a TBD SPICE_DATA method 'save_level3, ana=ana' (or so) will be called, or not?
  • What if user calls spice_xcfit_block from GUI, should he then get a choice to save data as FITS file?

FITS file

How should the FITS file with the ana data look like?

Discussion

Detailed FITS file specifications

Main header keywords

  • SPICE FITS filename
  • More info about/from the original SPICE FITS file?
  • Datasource
  • Definition
  • Label
  • Missing
  • History

Extension 1 = Data

with keywords from original FITS file:

  • WCS keywords
  • BUNIT, BTYPE
  • more?

Extension 2 = Lambda

Not needed, can be recalculated

Extension 3 = Weights

keywords:

  • BUNIT, BTYPE
  • more?

Extension 4 = Result

keywords:

  • BUNIT, BTYPE
  • more?

Extension 5 = Residual

Not needed, can be recalculated

Extension 6 = Include

keywords:

  • BUNIT, BTYPE
  • more?

Extension 7 = Const

keywords:

  • BUNIT, BTYPE
  • more?

FIT

how to include FIT components into FITS file?

Origin

?

Scale

?

Phys_scale

?

Dimnames

?