Skip to content

Commit

Permalink
Add followup example to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
astrojarred committed Oct 24, 2024
1 parent 90892d5 commit 235c8e2
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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<a name ="example-simulation"></a>

```python
from astropy import units as u
Expand Down Expand Up @@ -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<a name ="example-followup"></a>

```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': <Quantity 2.623 rad>,
# 'lat': <Quantity 0.186 rad>,
# 'eiso': <Quantity 2.67e+50 erg>,
# 'dist': <Quantity 466000. kpc>,
# 'obs_time': <Quantity 169. s>,
# 'error_message': '',
# 'angle': <Quantity 24.521 deg>,
# 'ebl_model': 'franceschini',
# 'min_energy': <Quantity 0.02 TeV>,
# 'max_energy': <Quantity 10. TeV>,
# 'seen': True,
# 'start_time': <Quantity 10. s>,
# 'end_time': <Quantity 179. s>,
# 'id': 4
# }
```

### Reading Results<a name = "instructions-reading"></a>

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.
Expand Down

0 comments on commit 235c8e2

Please sign in to comment.