Skip to main content

Create ULLYSES data products

Project description

ULLYSES

This repository contains the codes used to create the high level science products (HLSPs) for the targets in the Hubble Space Telescope’s (HST) Ultraviolet Legacy Library of Young Stars as Essential Standards (ULLYSES) program. In particular, the spectral coaddition algorithm used by the HASP (Hubble Advanced Spectral Products) is included in the ULLYSES package.

See more info about ULLYSES and its targets at ullyses.stsci.edu. A full description of the data products produced by the ULLYSES team can be found at ULLYSES Data Products.

Installation

The ullyses package can be installed into a virtualenv or conda environment via pip. We recommend that for each installation you start by creating a fresh environment that only has Python installed and then install the ullyses package and its dependencies into that bare environment. If using conda environments, first make sure you have a recent version of Anaconda or Miniconda installed.

All package dependencies will be installed with ullyses, including ullyses-utils, which contains the utility scripts and data files used to create HLSPs. The only exceptions are the stisblazefix and CalSTIS packages, which must be installed manually, but only if you wish to create blaze-corrected products or custom-calibrated STIS products. Instructions for installing stisblazefix are available in the stisblazefix documentation. To install CalSTIS, you must use stenv.

Installing the Latest Release

The first two steps are to create and activate an environment:

conda create -n <env_name> python=3.9
conda activate <env_name>

Python version 3.9 or greater is required for some dependencies, including calcos, the COS data calibration pipeline used in these scripts.

Then simply install the latest release of ullyses from pip:

pip install ullyses

Installing the Development Version

To install your own copy of the development version from github, you first need to fork and clone the ullyses repo:

cd <where you want to put the repo>
git clone https://github.com/spacetelescope/ullyses
cd ullyses

Then install from your local checked-out copy:

pip install -e .

Creating HLSPs (High Level Science Products)

There are four main types of ULLYSES HLSPs:

  1. coadded and abutted spectra
  2. timeseries spectra
  3. re-packaged drizzled images
  4. custom-calibrated individual spectra, or level0 HLSPs

Below are instructions for creating each type of HLSP.

Coadded and Abutted Spectral HLSPs

Coadded and abutted spectra are created for each target. Currently supported instruments are HST/COS, HST/STIS, and FUSE. The input files are _x1d.fits or _sx1.fits files for COS and STIS, and _vo.fits for FUSE. These input files may also be level0 (custom-calibrated spectra, see below) themselves. Coadded and abutted spectra can then be created programmatically, or using the command-line script, coadd.

From the command line:

coadd -i <input_directory> -o <output_directory>

Where <input_directory> contains the data to be coadded, and the products will be written to <output_directory>.

A directory, or a specific set of files, can be provided programmatically:

from ullyses.ullyses_coadd_abut_wrapper import main, coadd_and_abut_files
coadd_and_abut_files(file_list, output_directory)
main(input_directory, output_directory)

Regardless of what files are specified in the input list or directory, only files of the same instrument and grating combination will be coadded. Data from all input gratings will be abutted according to the strategy adopted by ULLYSES.

Timeseries Spectra HLSPs

There are two main flavors of timeseries spectra: exposure level and sub-exposure level. Exposure level timeseries spectra are essentially stacked individual 1D spectra. Sub-exposure level timeseries spectra are made from split 1D spectra. That is, for time-tag data (currently only COS/UV), exposures are broken down into even smaller time chunks, then stacked.

HST Timeseries

For HST, both exposure and sub-exposure timeseries spectra are created the same way. To create an HST timeseries spectrum, you must supply a configuration YAML file. The ULLYSES team has already created such files for the monitoring stars (V-TW-HYA, V-BP-TAU, V-RU-LUP, V-GM-AUR) and recorded the optimal parameters in YAML files stored in the ullyses-utils repository. You may use the ULLYSES YAML files as input, or supply your own, but they must conform to the required format. See the TW Hydra YAML file as an example.

WARNING: To create the HST timeseries spectra, individual split exposures must be created and calibrated. This process can be very time-consuming, taking up to several hours on some systems.

Once you have a YAML file, you create the timeseries spectrum like so:

python ctts_cal.py --orig <origdir> --copydir <copydir> --hlspdir <hlspdir> --targ <targ> --yaml <yaml>

where <origdir> is the directory which houses all the input data, <copydir> is the directory to copy input data to (data will be modified), <hlspdir> is the directory to write the final timeseries spectra, <targ> is the ULLYSES name of the target being calibrated, and <yaml> is the YAML confirmation file. If no YAML file is supplied, the target name will be used to fetch the appropriate file from the ullyses-utils repository.

The ctts_cal.py also corrects for vignetting in the COS/NUV data.

Photometric Timeseries

It is possible to create a timeseries "spectrum" using photometric measurements over time. The ULLYSES team has performed photometry on ULLYSES low-mass stars using the LCOGT network of telescopes.

To create LCOGT photometric timeseries spectra:

python lcogt_hlsps_wrapper.py -i <indir> -o <outdir> -t <targ>

where <indir> is the directory which contain the original LCOGT FITS images (used to extract observational metadata), <outdir> is the directory to write the HLSPs, and <targ> is the ULLYSES target name. The target name will be used to fetch the appropriate photometric measurements in the ullyses-utils repository.

Re-packaged Drizzled Image HLSPs

The ULLYSES team creates drizzled WFC3 images for the low-metallicity galaxies NGC3109 and SextansA. These images are repackaged to conform to the ULLYSES HLSP requirements, but the data array values are left untouched.

To create drizzled image HLSPs:

python imaging_hlsps_wrapper.py <drcfile> -o <outdir> -t <targ>

where <drcfile> is the name of the original drizzled DRC file, <outdir> is the directory to write the HLSP to, and <targ> is the ULLYSES target name.

Optional arguments are:

  --hdr_targ HDR_TARG   If specified, alternative target name to use in HLSP file name
  --hlspname HLSPNAME   Name of output HLSP file. By default, follows ULLYSES standard

Custom Calibrated Spectra HLSPs

Prior to turning spectra into ULLYSES HLSPs, some targets require extra processing to fix various calibration issues. For example, STIS/G750L data must be defringed, or wavelength offsets must be corrected. Once these custom calibration steps have been applied, a keyword is added to the output FITS file signifying that the file should be considered a level0 HLSP- that is, a custom-calibrated individual 1D spectrum. The various level0 products, and how to create them, are described below.

Custom Calibrated STIS spectra

All T Tauri star STIS CCD observations, and a subset of STIS NUV- and FUV-MAMA observations, require tailored calibrations. Special calibration steps can include: custom hot pixel identification and flagging, defringing for G750L observations, and customized spectral extraction parameters for T Tauri stars and their companions.

To create a custom-calibrated STIS spectra, you must supply a configuration YAML file which lists the specific calibration parameters. The ULLYSES team has already examined each T Tauri star and recorded the optimal custom calibration parameters in YAML files stored in the ullyses-utils repository. You may use the ULLYSES YAML files as input, or supply your own, but it must conform to the format outlined here.

Once you have a YAML file, you create the custom-calibrated STIS spectrum like so:

python calibrate_stis_data.py -i <indir> -y <yaml> -o <outdir>

where <indir> is the input directory that houses the data you wish to calibrate, <yaml> is the name of the yaml file, and <outdir> is the output directory where products, logs, and diagnostic plots will be written. A log file of the format YYYYMMDD_HHmm_cal.log will be written, unless otherwise specified using the optional arguments below.

Optional arguments are:

  -c, --clobber                     If True, overwrite existing products
  --nolog                           If True, do not produce log file
  -l LOGFILE, --logfile LOGFILE
                                    Alternative name of output log file

Wavelength-shifted COS spectra

If a target is not perfectly centered in the COS aperture, the wavelength array can be offset from its true values. Wavelength offsets can be easily corrected by recalibrating the data and supplying a shift file to CalCOS, as described in the COS Data Handbook.

The ULLYSES team has identified stars which require such wavelength offset corrections and documented the necessary shifts in text files stored in the ullyses-utils repository.

Once you have a shift file, you can create wavelength-shifted COS spectra by supplying a directory with multiple exposures, or by supplying a single file. You can create wavelength-shifted COS spectra using the pre-defined ULLYSES shift files like so:

python apply_cos_shifts.py <infiledir> <outdir> 

where <infiledir> is the input filename or directory of files that should be shifted, and <outdir> is the directory to write shifted 1D spectra. In this case, the target name in the input file(s) header(s) must match the target name in the shift file. If for some reason it does not, you must also supply the target name as it appears in the shift file using an additional -t <targ> argument.

You may also create wavelength-shifted COS spectra using your own custom shift file, which is done like so:

python apply_cos_shifts.py <infiledir> <outdir> -s <shift_file>

where <shift_file> is the name of your custom shift file.

Other optional arguments are:

  --copydir COPYDIR     Name of directory to copy shifted products to
  -c, --overwrite       If True, overwrite existing products

Custom Flagged FUSE spectra

The ULLYSES team typically uses FUSE VO (Virtual Observatory) files with minimal modification. A DQ (Data Quality) array is added to each VO file, as is required by the ULLYSES pipeline. For the majority of FUSE targets, this DQ array is uniformly zero, meaning there are no data quality issues. However, for a handful of targets, custom flagging is imposed in order to screen out bad spectral regions. Possible DQ flags include:

  • DQ=1 (region was affected by the worm)
  • DQ=2 (poor photometric quality)

To create these custom-flagged FUSE spectra:

python make_flagged_fuse.py -i <infile> -o <outdir>

where <infile> is the file to flag and <outdir> is the output directory.

Other optional arguments are:

  -t TARG or --targ TARG  ULLYSES name of target
  -c or --overwrite       If True, overwrite existing products

Contributions and Feedback

We welcome contributions and feedback on this project. If you want to suggest changes to this content, please do the following:

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Add your changes to staging area (git add myfile); This can be repeated multiple times.
  4. If you are adding a new style guide, do not forget to update guides listing at README.md.
  5. Commit your changes in staging area (git commit -m 'Added some feature').
  6. Push to the branch (git push origin my-new-feature).
  7. Create new Pull Request (PR).
  8. Ask for a PR review.

We strive to provide a welcoming community to all of our users by abiding with the Code of Conduct.

If you have questions or concerns regarding the software, please open an issue or contact the HST Help Desk. If you have questions regarding the ULLYSES program design or data, please contact the HST Help Desk.

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

ullyses-4.1.0.tar.gz (82.5 kB view details)

Uploaded Source

Built Distribution

ullyses-4.1.0-py3-none-any.whl (89.4 kB view details)

Uploaded Python 3

File details

Details for the file ullyses-4.1.0.tar.gz.

File metadata

  • Download URL: ullyses-4.1.0.tar.gz
  • Upload date:
  • Size: 82.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for ullyses-4.1.0.tar.gz
Algorithm Hash digest
SHA256 a3fb592d2072aa1ef89e82c0b5e8ac294c54d12f7f61de9fce30e4b996d3f827
MD5 6e3e6add7c82dea1a78b094bf4d2a78e
BLAKE2b-256 f4272b7ceded4120674c939d98dcb848ab3de8ae6d924fd8cf6e6ccdae3da38b

See more details on using hashes here.

File details

Details for the file ullyses-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: ullyses-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 89.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for ullyses-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9aca1603bb18866a8c9632291b94189d1c59d083acb194913f929bd87ee8ae54
MD5 b99d1b306662d704dc9577d408380f69
BLAKE2b-256 6ca038a40da07f8c0821dbcd93613370775ade5c456a82c203ddc989aa35f178

See more details on using hashes here.

Supported by

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