-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
145 lines (107 loc) · 3.71 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
RUNS = O3 O4a O4 O5
POPS = farah
FILENAMES = events events.xml.gz events.sqlite injections.dat coincs.dat
all: psds injections public-alerts.dat
psds: $(foreach run,$(RUNS),runs/$(run)/psds.xml)
injections: $(foreach run,$(RUNS),$(foreach pop,$(POPS),$(foreach filename,$(FILENAMES),runs/$(run)/$(pop)/$(filename))))
.PHONY: all psds injections
#
# Tabulate O3 public alerts.
#
public-alerts.dat:
scripts/get-public-alerts.py
#
# PSD files to use from LIGO-T2200043.
#
O3-psds = \
--H1 aligo_O3actual_H1.txt \
--L1 aligo_O3actual_L1.txt \
--V1 avirgo_O3actual.txt
O4a-psds = \
--H1 aligo_O4low.txt \
--L1 aligo_O4low.txt
O4-psds = \
--H1 aligo_O4low.txt \
--L1 aligo_O4low.txt \
--V1 O4_Virgo_78.txt \
--K1 kagra_3Mpc.txt
O5-psds = \
--H1 AplusDesign.txt \
--L1 AplusDesign.txt \
--V1 avirgo_O5low_NEW.txt \
--K1 kagra_128Mpc.txt
O6-psds = \
--H1 AplusDesign.txt \
--L1 AplusDesign.txt \
--I1 AplusDesign.txt \
--V1 avirgo_O5high_NEW.txt \
--K1 kagra_128Mpc.txt
#
# Download official PSD files from the LIGO DCC.
#
%.txt:
curl -L https://dcc.ligo.org/LIGO-T2200043-v3/public/$(@F) > $@
#
# Pack PSDs into XML files for input to BAYESTAR.
#
.SECONDEXPANSION:
psd_files = $(sort $(filter-out --%,$(value $(1)-psds)))
runs/%/psds.xml: $$(call psd_files,%)
mkdir -p $(@D) && scripts/pack-psds.py -o $@ $(value $*-psds)
#
# Download samples from the Farah distribution.
# FIXME: this document must be public!
#
O1O2O3all_mass_h_iid_mag_iid_tilt_powerlaw_redshift_maxP_events_all.h5:
curl -OL https://dcc.ligo.org/LIGO-T2100512/public/O1O2O3all_mass_h_iid_mag_iid_tilt_powerlaw_redshift_maxP_events_all.h5
#
# Convert the Farah samples to the format needed by bayestar-inject.
#
farah.h5: O1O2O3all_mass_h_iid_mag_iid_tilt_powerlaw_redshift_maxP_events_all.h5 scripts/farah.py
scripts/farah.py $< $@
#
# Generate astrophysical distribution.
#
runs/%/farah/injections.xml: $$(dir $$(@D))psds.xml farah.h5
mkdir -p $(@D) && cd $(@D) && bayestar-inject -l error --seed 1 -o $(@F) -j \
--snr-threshold 1 --distribution-samples ../../../farah.h5 --reference-psd ../psds.xml \
--min-triggers 1 --nsamples 1000000
runs/%/injections.xml: $$(dir $$(@D))psds.xml
mkdir -p $(@D) && cd $(@D) && bayestar-inject -l error --seed 1 -o $(@F) -j \
--snr-threshold 1 --distribution $(notdir $(@D)) --reference-psd ../psds.xml \
--min-triggers 1 --nsamples 1000000
#
# Generate and detect simulated signals.
#
runs/%/events.xml.gz: runs/%/injections.xml $$(dir $$(@D))psds.xml
mkdir -p $(@D) && cd $(@D) && bayestar-realize-coincs \
--seed 1 -j -l error -o $(@F) $(<F) \
--reference-psd ../psds.xml \
--snr-threshold 1 \
--net-snr-threshold $(if $(filter bbh_astro,$(word 2,$(subst /, ,$*))),9,8) \
--min-triggers 1 \
--duty-cycle 0.7 --keep-subthreshold --measurement-error gaussian-noise \
--detector $(subst --,,$(filter --%,$(value $(firstword $(subst /, ,$*))-psds)))
#
# Split detected signals file into individual files, one file per event.
#
runs/%/events: runs/%/events.xml.gz
scripts/split-events.py $< $@
#
# Convert simulated signals to SQLite format.
#
runs/%/events.sqlite: runs/%/events.xml.gz
ligolw_sqlite -p -r -d $@ $<
#
# Generate convenient ASCII tables.
#
space := $(empty) $(empty)
tab := $(empty) $(empty)
injections_dat_columns := simulation_id longitude latitude inclination distance mass1 mass2 spin1z spin2z
coincs_dat_columns := coinc_event_id ifos snr
%/injections.dat: %/events.xml.gz
echo "$(subst $(space),$(tab),$(injections_dat_columns))" > $@ && \
ligolw_print -t sim_inspiral $(injections_dat_columns:%=-c %) -d "$(tab)" $< >> $@
%/coincs.dat: %/events.xml.gz
echo "$(subst $(space),$(tab),$(coincs_dat_columns))" > $@ && \
ligolw_print -t coinc_inspiral $(coincs_dat_columns:%=-c %) -d "$(tab)" $< >> $@