lincc-frameworks / tape

[Deprecated] Package for working with LSST time series data
https://tape.readthedocs.io
MIT License
12 stars 3 forks source link

Add an Intro Animation/Display #404

Open dougbrn opened 5 months ago

dougbrn commented 5 months ago

Having a front and center animation that showcases fundamental usage of TAPE is probably the ideal starting point for our documentation. We're envisioning some kind of example like this, where this workflow is generated iteratively with some checkpoints to show tables/plots:

# Load some ZTF Data
from tape import Ensemble, ColumnMapper

colmap = ColumnMapper().use_known_map("ztf")
ens= Ensemble().from_hipscat("https://epyc.astro.washington.edu/~lincc-frameworks/half_degree_surveys/ztf/ztf_source",
                "https://epyc.astro.washington.edu/~lincc-frameworks/half_degree_surveys/ztf/ztf_object",
                column_mapper=colmap, source_index="ps1_objid", object_index="ps1_objid")

# Do some filtering
ens.calc_nobs(by_band=True)
ens.object.query("nobs_g > 50").update_ensemble()

# Compute the Periodogram for all lightcurves
import light_curve as lc
periodogram = lc.Periodogram()
ens.batch(periodogram, band_to_calc="g", label="periodograms")

# Plot the periodogram distribution, or some kind of multi-lightcurve plot
import matplotlib.pyplot as plt
periods = ens.select_frame("periodograms")
plt.hist(periods)

# Drill into a particular lightcurve by period
max_id = periods.iloc[result_comp['result'].argmax()]["id"]
ens.to_timeseries(max_id).plot()

As part of this ticket, the goal is also to fine-tune the API to achieve this workflow with a minimal amount of keystrokes (and fix any bugs present in this example). Therefore, a number of issues will be added that block this, as they are identified.