Fast Imaging Solar Spectrograph

Examples


Make align data cube

View


function fisspy.align.alignment.alignAll(lfA, lfB, refFrame=None, refCam='A', sname=None, save=True)

Description: Align data with time and co-align the data of two cams.

Parameters

  • lfA (list) - A series of the camA data files.
  • lfB (list) - A series of the camB data files.
  • refFrame (int, optional) - Reference frame number. If None, the middle frame (time) is considered as a reference. Default is None.
  • refCam (str, optional) - Reference camera for the alignment. Either 'A' or 'B'. Default is 'A'.
  • save (bool, optional) - Save align paramereters in the working directory. Default is True.

Returns



function fisspy.align.alignment.alignTwoDataCubes(dataA, dataB, faparA, faparB, xmargin=None, ymargin=None, cubic=False)

Description: Align two 3D data cubes. Note that the data will be flipped in the x-axis to correct the mirror reversal.

Parameters

  • dataA (numpy.ndarray) - 3-dimensional data array for the cam A with the shape of (nt, ny, nx).
  • dataB (numpy.ndarray) - 3-dimensional data array for the cam B with the shape of (nt, ny, nx).
  • faparA (str) - File name of the alignpar for cam A.
  • faparB (str) - File name of the alignpar for cam B.
  • xmargin (int, optional) - Margin for x-axis. The size of the x-axis increases to nx + 2*xmargin. If None, automatically calculate the margin. Default is None.
  • ymargin (int, optional) - Margin for y-axis The size of the y-axis increases to ny + 2*ymargin. If None, automatically calculate the margin. Default is None.
  • cubic (bool, optional) - Use cubic interpolation to determine the value in the aligned position. If False, use linear interpolation. Default is None.

Returns

  • cdata (numpy.ndarray) - Aligned data.


function fisspy.align.alignment.saveAlignCube(adata, time, sname, dt=None, dx=0.16*725, dy=0.16*725)

Description: Save aligned data cube.

Parameters

  • adata (numpy.ndarray) - 3D array of the aligned data (nt,ny,nx).
  • time (numpy.ndarray) - 1D time array in unit of second.
  • sname (str) - Filename to save. Extension should be '.npz.'
  • dt (float, optional) - Pixel scale along the t-axis in unit of second.
  • dx (float, optional) - Pixel scale along the x-axis in unit of km.
  • dy (float, optional) - Pixel scale along the y-axis in unit of km.

Returns

  • None


function fisspy.align.alignment.writeAlignPars(apar, refCam=None, sname=None)

Description: Write a file for the align parameters.

Parameters

  • apar (dict) - Parameter to align the data files. See fisspy.align.alignment.calAlignPars.
  • refCam (str, optional) - Reference camera for the alignment.
  • sname (str, optional) - Save file name. The extension should be .npz. Default is alignpar_{apar['cam']} in the current working directory.

Returns

  • None


function fisspy.align.alignment.readAlignPars(apfile)

Description: Read file for the align parameters.

Parameters

  • apfile (str) - Filename for the align parameters.

Returns

  • apar (numpy.lib.npyio.NpzFile) - Align parameters. keys: ['cam', 'refFrame', 'refTime', 'time', 'xc', 'yc', 'dx', 'dy', 'angle', 'refCam']


function fisspy.align.alignment.calAlignPars(lfiles, refFrame=None)

Description: Calculate the parameters to be used for the alignment for given series of the line spectra.

Parameters

  • lfiles (list) - A series of the FISS data files (either cam A or cam B)
  • refFrame (int, optional) - Reference frame number. If None, the middle frame (time) is considered as a reference. Default is None.

Returns

  • alignPars (dict) - Parameter to align the data files. It consists of 9 elements: (1) 'cam'-camera information either 'A' or 'B'. (2) 'refFrame'-Reference frame number. (3) 'refTime'-(str) isot time for the reference frame. (4) 'time'-relative time to the reference time in the unit of second. (5) 'xc'-x posiotion of the center of the rotation. (6) 'yc'-y posiotion of the center of the rotation. (7) 'dx'-shift in the direction of the x axis. (8) 'dy'-shift in the direction of the y axis. (9) 'angle'-angle of the image rotation.


function fisspy.align.alignment.alignCams(frefA, frefB, refCam='A')

Description: Align two cameras.

Parameters

  • frefA (str) - Filename of the camera A for the reference frame.
  • frefB (str) - Filename of the camera B for the reference frame.
  • refCam (str, optional) - Reference camera for the alignment. Either 'A' or 'B'. Default is 'A'.

Returns

  • refCam (str) - Reference camera for the alignment.
  • dx (float) - Shift in the direction of the x axis.
  • dy (float) - Shift in the direction of the y axis.


function fisspy.align.alignment.alignDataCube(data, fapar, xmargin=None, ymargin=None, cubic=False)

Description: Align 3D data cube for given apar. Note that the data will be flipepd in the x-axis to correct the mirror reversal. Please do not use this function when you use two data cubes of two cams, but use fisspy.align.alignment.alignTwoDataCubes.

Parameters

  • data (numpy.ndarray) - 3-dimensional data array with the shape of (nt, ny, nx).
  • fapar (dict) - File name of the alignpar.
  • xmargin (int, optional) - Margin for x-axis. The size of the x-axis increases to nx + 2*xmargin. If None, automatically calculate the margin. Default is None.
  • ymargin (int, optional) - Margin for y-axis. The size of the y-axis increases to ny + 2*ymargin. If None, automatically calculate the margin. Default is None.
  • cubic (bool, optional) - Use cubic interpolation to determine the value in the aligned position. If False, use linear interpolation. Default is None.

Returns

  • cdata (numpy.ndarray) - Aligned data.

Back to home