Skip to main content

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.

Release files for stispectrograph 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stispectrograph 0.2
File Size Uploaded
stispectrograph-0.2.tar.gz 14.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stispectrograph 0.2
File Interpreter ABI Platform
stispectrograph-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.5 kB

Release files / stispectrograph-0.2.tar.gz

Download URL stispectrograph-0.2.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
18a075397ae459a3bdd1bdecbf62f91ccbfc5f4f7711655579513761ff25edac
BLAKE2b-256 checksum
How to use checksums
0d7e2e91c3fa0ab9c0936c040e54a7fb2236d86e61db5f8a1582a9603614811c
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / stispectrograph-0.2-py3-none-any.whl

Download URL stispectrograph-0.2-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
baf677455a7d856ead9df18744ad8c6a07bcd8ba476a1058acb78fddfcc26cb6
BLAKE2b-256 checksum
How to use checksums
07df59ead6aaa8330796a7fc1c7f0da882073a51ab00acdd9db132ccfa8619cf
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page