Skip to content

Latest commit

 

History

History
87 lines (74 loc) · 3.62 KB

README.md

File metadata and controls

87 lines (74 loc) · 3.62 KB

Kathleen's cutouts: postage stamps along the trajectory of a moving object

A Python package by the Asteroid Institute, a program of the B612 Foundation

Python 3.7+ License DOI
Python Package with conda Publish Python Package to conda
Anaconda-Server Badge Anaconda-Server Badge Anaconda-Server Badge

Installation

Conda

To get the latest released version and install it into a conda environment:
conda install -c asteroid-institute cutouts

Source

To install the bleeding edge source code, clone this repository and then:

If you use conda to manage packages and environments:
conda install -c defaults -c conda-forge --file requirements.txt
pip install . --no-deps

If you would rather download dependencies with pip:
pip install -r requirements.txt
pip install . --no-deps

Example

To reproduce the example that ships with the repository:

import pandas as pd
import matplotlib.pyplot as plt
from astropy.time import Time
from cutouts import get_cutouts
from cutouts import plot_cutouts

# Read in observations and predicted ephemerides
observations = pd.read_csv("examples/2013_RR163.csv", index_col=False)

# Extract relevant quantities
ra = observations["pred_ra_deg"].values
dec = observations["pred_dec_deg"].values
vra = observations["pred_vra_degpday"].values
vdec = observations["pred_vdec_degpday"].values
obscode = observations["obscode"].values
mag = observations["mag"].values
filter = observations["filter"].values 
mag_sigma = observations["mag_sigma"].values
times = Time(observations["mjd_utc"].values, scale="utc", format="mjd")
exposure_id = observations["exposure_id"].values

# Find cutouts and save them
NSC_SIA_URL = "https://datalab.noirlab.edu/sia/nsc_dr2"
cutout_paths, cutout_results = get_cutouts(
    times, ra, dec, 
    sia_url=NSC_SIA_URL, 
    exposure_id=exposure_id, 
    out_dir="examples/cutouts"
)
exposure_time = cutout_results["exptime"].values.astype(int)

# Plot cutouts
fig, ax = plot_cutouts(
    cutout_paths, 
    times, 
    ra, dec, 
    vra, vdec, 
    filters=filter,
    mag=mag, 
    mag_sigma=mag_sigma, 
    exposure_time=exposure_time,
    cutout_height=75, 
    cutout_width=75,
)
fig.suptitle(f"(2013 RR163)", y=1.0)
fig.savefig(f"examples/2013_RR163.jpg", bbox_inches="tight")

2013 RR163) Cutouts Example

cutouts also comes with a simple command line interface (CLI) to quickly produce a grid of cutouts from a file of predicted ephemerides and observations.

cutouts examples/2013_RR163.csv --out_dir examples/cli_test