From 235c8e2efecf90ed8e8155841aa8e0b9088029d0 Mon Sep 17 00:00:00 2001 From: Jarred Green Date: Thu, 24 Oct 2024 16:24:34 +0200 Subject: [PATCH] Add followup example to the readme --- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 948037a..4718db6 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ - [Authors](#️authors) - [Instructions](#instructions) - [GW Observations](#instructions-gw-obs) + - [Example Simulation](#example-simulation) + - [Example followup calculation](#example-followup) - [Reading Results](#instructions-reading) - [Plotting Heatmaps](#instructions-plotting) @@ -91,7 +93,7 @@ This code simulates observations of simulated gravitational wave events to deter - a dictionary object containing detection information and parameters of the event itself (extracted from the model) -#### Example +#### Example Simulation ```python from astropy import units as u @@ -146,6 +148,54 @@ print(f"Observation time at delay={delay_time} is {res_ebl['obs_time']} with EBL # Obs time at delay=1800.0 s is 1292.0 s with EBL=franceschini ``` +### Example followup calculation + +```python +import astropy.units as u +import pandas as pd +from gravitational_wave_toy import followup + +lookup_talbe = "./O5_gammapy_observations_v4.parquet" + +# optional, but it's recommended to load the DataFrame first save time +# otherwise you can directly pass the filepath to the get_exposure method +lookup_df = pd.read_parquet(lookup_talbe) + +event_id = 1 +delay = 10 * u.s +site = "north" +zenith = 60 +ebl = "franceschini" + + +followup.get_exposure( + event_id=event_id, + delay=delay, + site=site, + zenith=zenith, + extrapolation_df=lookup_df, + ebl=ebl, +) + +# returns, e.g. +# { +# 'long': , +# 'lat': , +# 'eiso': , +# 'dist': , +# 'obs_time': , +# 'error_message': '', +# 'angle': , +# 'ebl_model': 'franceschini', +# 'min_energy': , +# 'max_energy': , +# 'seen': True, +# 'start_time': , +# 'end_time': , +# 'id': 4 +# } +``` + ### Reading Results Note: The most recent simulations for CTA for the O5 observing run are [available on the CTA XWiki](https://cta.cloud.xwiki.com/xwiki/wiki/phys/view/Transients%20WG/Chasing%20the%20counterpart%20of%20GW%20alerts%20with%20CTA/O5%20Observation%20times%20with%20gw-toy%20package/) for CTA members.