Skip to main content

A replacement for "ST-i Spectroscopy Program" by SBIG.

Project description

stispectrograph

astropy

This is a python package and script meant to replace part (maybe eventually all) of the functionality of SBIG's "ST-i Spectroscopy Program" used with the ST-i spectrograph.

This package defaults to Angstrom for wavelength, like the original software.

Installation

pip install stispectrograph

Or clone github repo and install from source:
python setup.py install

Functionality

The included script fits_to_csv.py can be used as a command line tool to extract spectral data from fits files to csv, similar to the "Save Spectral Data as Text File" function in the original software.

I recommend taking exposures using SBIG's CCDops software, using the procedure given in the spectrograph manual. This software will only accept images with dimensions 121x648 pixels, which in CCDops means setting resolution to 1xN and vertical binning to 4.

Usage: fits_to_csv mercury_line_pixel [path] [nm]

The csv files are created in the same directory as the images, with the same names. The x-value at which the 5461 A mercury line appears in the image must be provided. If a path to a directory is specified, extracts data from all FITS files in that directory. If a filename is specified instead, extracts data from that file only. Omitting a path extracts data from all files in the current working directory. If the argument "nm" is provided, outputs wavelength in nm instead of A.

The pixel value at which the 5461 A mercury line appears in the image depends on the calibration process. Consult the spectrograph manual for how to identify this line.

Examples:
fits_to_csv 337 image.FIT Extracts data from image.FIT and creates image.csv in the same directory.
fits_to_csv 337 Astronomy\images Extracts data from all fits files in Astronomy\images, creating separate csv files for each in that directory.
fits_to_csv 337 "C:\Documents\Astronomy\Spectrograph images\image.fit" nm Extracts data from image.fit, with the wavelength in nanometers.
fits_to_csv 337 nm Extracts data from all fits files in the current working directory, with the wavelength in nanometers.

For more advanced use cases, such as getting binned data, cropping to a specific part of the image (the defualt crop is like the original software's, pixel 55 to 65) or getting the data in a different format, the python package can be used to build other tools. I'm working on better documentation, for now the comments in the code will have to suffice.

The current implementation has:

  • The class stispectrograph.image.Image, for extracting data from spectrograph images in fits format.
  • The module stispectrograph.io with functions for saving data to csv, and getting data from csv and csv-formatted strings.
    • stispectrograph.io.to_csv
    • stispectrograph.io.from_csv
    • stispectrograph.io.from_csv_string
  • The module stispectrograph.visualisation which can currently create a nice colored graph of data. Work is in progress to create functionality similar to the original software.
  • A dictionary relating horizontal pixels (relative to the 5461 A Mercury line) to the corresponding wavelengths (stispectrograph.constants.WAVELENGTH_PER_PIXEL).

TODOs

  • Create better documentation for the stispectrograph package.
  • Create a visualisation of the spectrum, like the original software.
  • Create additional scripts, or a more universal tool.

This software is published under the MIT License, see LICENSE.txt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stispectrograph-0.2.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stispectrograph-0.2-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file stispectrograph-0.2.tar.gz.

File metadata

  • Download URL: stispectrograph-0.2.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for stispectrograph-0.2.tar.gz
Algorithm Hash digest
SHA256 18a075397ae459a3bdd1bdecbf62f91ccbfc5f4f7711655579513761ff25edac
MD5 3e020643ebab25e54c7c1dec18e03c86
BLAKE2b-256 0d7e2e91c3fa0ab9c0936c040e54a7fb2236d86e61db5f8a1582a9603614811c

See more details on using hashes here.

File details

Details for the file stispectrograph-0.2-py3-none-any.whl.

File metadata

  • Download URL: stispectrograph-0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for stispectrograph-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 baf677455a7d856ead9df18744ad8c6a07bcd8ba476a1058acb78fddfcc26cb6
MD5 d48c44bddc07f0ee02d161ed329951e2
BLAKE2b-256 07df59ead6aaa8330796a7fc1c7f0da882073a51ab00acdd9db132ccfa8619cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page