Skip to content
Bruno Quint edited this page Jul 26, 2016 · 4 revisions

xjoin.py

Every single .fits file obtained with SAMI, SAM's Imager, has four extension. I find it much easier to work with files that contains a single extension so I created the xjoin.py script joins all the extensions and a lot of other things.

This script will always:

  • Read each extension;
  • Read the overscan region for each extension based on information in the header;
  • Collapse (sum) the overscan region in the short axis;
  • Fit a 3rd degree polynomium to the overscan region;
  • Subtract the fitted polynomium from every column of each extension;
  • Put all the extensions together in a single array;

After that, this script may also:

  • Simple BIAS subtraction;
  • Simple DARK subtraction;
  • Simple division by FLAT;
  • Simple division by the exposure time (EXPTIME);
  • Clean hot columns and lines;
  • Clean cosmic rays using LACosmic and CCDProc;
  • Remove the instrument fingerprint that sometimes shows up as glows in the lower lateral borders;
  • Add HISTORY card that stores all the steps taken with it.

Usage

This file can be executed in a common terminal by simply calling

  $ python xjoin.py [options] file1 file2 ... fileN

Or

  $ chmod a+x xjoin.py
  $ ./xjoin.py [options] file1 file2 ... fileN

The options can be printed if one executes

  $ python xjoin.py --help

or

  $ python xjoin.py -h

mkcube.py

This script creates a new data-cube based on the FITS images given as input. It first walks ovel all files and create a table that contains the filename, the number of pixels in X, in Y and the Fabry-Perot spacing in Binary-Control-Value units (BCV).

Based on this table, this script checks if all input has the same X and Y dimentions. It also created a Z calibration that relates the channel number to a BCV number. Since the wavelength decreases as the BCV increases, the script reverse the data-cube in Z so the wavelength increases with the channels.

The creation of the Z calibration mentioned above is needed because some scans are done with steps slightly unneven. With this fit, the difference between the fitted Z and the actual Z in a channel shall be smaller than 0.5 BCV since the Fabry-Perot controller accepts only integer values.

If there is more than an FITS image for a given channel, it is possible to tell the script which algorithm it should use to combine them. The options available are mean/average, median and sum.

Usage

This file can be executed in a common terminal by simply calling $ python mkcube.py [options] file1 file2 ... fileN Or $ chmod a+x mkcube.py $ ./mkcube.py [options] file1 file2 ... fileN The options can be printed if one executes $ python mkcube.py --help or $ python mkcube.py -h

phmxtractor.py

When we observe with a Fabry-Perot, we take several images while changing the gap size between the two FP plates. This process is called scanning or a scan. For each gap size, the information (light) related to a single wavelength lies on a ring. As we increase the gap size, this ring increases in radius.

When we stack all the images obtained in a scan, the information related to a given wavelength lies on a parabolic surface along the data-cube. At this point, we need to shift each pixel's spectrum to align this information so all the light at a given wavelength lies in a single frame.

For that, we use a calibration data-cube obtained with a comparison lamp and a narrow-band filter to map how this shift have to applied. We call this map the phase-map. This script measures that by using numpy.argmax.

This script also measures:

  • The _Free-Spectral-Range or FSR;
  • The center of the rings;
  • The full-width at half-maximum (fwhm).

These three parameters are usefull for further steps in the data-reduction or even for data-acquisition. They are all stored in the header of the phase-map extracted.

phmfit.py

apply.py

wcal.py

Clone this wiki locally