Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Removed xml dependence from pycbc_pygrb_page_tables #4649

Merged
merged 80 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
d6f1114
Sync pycbc_multi_inspiral
MarcoCusinato Feb 14, 2024
b802210
Sycn page_tables
MarcoCusinato Feb 14, 2024
e7b7bde
Sync ppu
MarcoCusinato Feb 14, 2024
67fdf9d
Added back required=True
MarcoCusinato Feb 14, 2024
c058fca
Removed ported SNR from glue
MarcoCusinato Feb 22, 2024
221c4b0
merged with master
MarcoCusinato Feb 22, 2024
a27bc43
Merge branch 'gwastro:master' into page-tables-s
MarcoCusinato Mar 7, 2024
8eae911
Addressed code climate
MarcoCusinato Mar 7, 2024
0f15b58
Addressed code climate
MarcoCusinato Mar 7, 2024
7d4e515
Addressed code climate
MarcoCusinato Mar 7, 2024
663068e
Merge branch 'gwastro:master' into page-tables-s
MarcoCusinato Mar 12, 2024
7fef8aa
Merge branch 'gwastro:master' into page-tables-s
MarcoCusinato Apr 2, 2024
0826b50
Reverted changes in multi_inspiral
MarcoCusinato Apr 2, 2024
1011508
Copied Jacob's sort_trigs function
MarcoCusinato Apr 2, 2024
d34dfb9
get_bestnrs reverted back, used slide_id in extract basic trig proper…
MarcoCusinato Apr 2, 2024
12c2e0e
Modified extract_basic_trig_properties
MarcoCusinato Apr 3, 2024
1acd1d6
Modified extract_basic_trig_properties
MarcoCusinato Apr 3, 2024
f1c2101
Reworked trigs
MarcoCusinato Apr 3, 2024
de6fbe7
Used hdf directly for the onsoyrce file
MarcoCusinato Apr 4, 2024
1bc91d3
Removed load_trig_data
MarcoCusinato Apr 4, 2024
ab05d53
Moved load_missed_found_injections to page_tables executable
MarcoCusinato Apr 4, 2024
0de04b8
Closed hdf files and completed injections
MarcoCusinato Apr 5, 2024
8cc9d74
Moved load_missed_found_injection
MarcoCusinato Apr 5, 2024
6f81998
Removed load_injections
MarcoCusinato Apr 5, 2024
27bbe28
Merge branch 'gwastro:master' into page-tables-s
MarcoCusinato Apr 5, 2024
53e6f83
Changed for in recovered params
MarcoCusinato Apr 9, 2024
8686ae1
changed for in filtrer_stats
MarcoCusinato Apr 9, 2024
ac64978
Fixed loops
MarcoCusinato Apr 9, 2024
d0530cd
Added function to calculate distance and chirp mass
MarcoCusinato Apr 9, 2024
9c2b904
Removed reconstructed ra and dec
MarcoCusinato Apr 9, 2024
c56401a
Addressed codeclimate
MarcoCusinato Apr 9, 2024
be4a8fe
Added recovered spin
MarcoCusinato Apr 9, 2024
05355db
Added tc to inj_params
MarcoCusinato Apr 12, 2024
2d5c2c3
Added tc to inj_params
MarcoCusinato Apr 12, 2024
e2ddbb6
Added ra and dec to on_trigs
MarcoCusinato Apr 12, 2024
07c2967
Added ra and dec to off_trigs
MarcoCusinato Apr 12, 2024
c9c802b
Removed closing twice trig_data
MarcoCusinato Apr 12, 2024
81b5db3
Added formatting for offsource trigs
MarcoCusinato Apr 12, 2024
041cbe2
Added logging info
MarcoCusinato Apr 12, 2024
120854f
Added recovered ra dec for found injections
MarcoCusinato Apr 12, 2024
6c7fbd2
removed / from subsets
MarcoCusinato Apr 18, 2024
7b45891
Added 'rec_ra', 'rec_dec' at line 774
MarcoCusinato Apr 18, 2024
b643654
Removed `,`at line 769
MarcoCusinato Apr 18, 2024
63a32d1
Removed `opts` at line 582
MarcoCusinato Apr 18, 2024
a8abd59
Removed spaces at line 643
MarcoCusinato Apr 18, 2024
4be70fb
Added comment about missed injections
MarcoCusinato Apr 18, 2024
a41f157
Removed get_bestnrs
MarcoCusinato Apr 18, 2024
8f3d747
Removed vetoes function
MarcoCusinato Apr 18, 2024
1fc0660
Reverted back to previous extract basic trig properties
MarcoCusinato Apr 18, 2024
a673c75
Used reweighted snr correctly
MarcoCusinato Apr 18, 2024
9f72006
Removed spaces
MarcoCusinato Apr 19, 2024
bf6f0f7
Changed comment
MarcoCusinato Apr 19, 2024
f9b3f9e
Fixed typo
MarcoCusinato Apr 19, 2024
4a9e7da
Changed comment
MarcoCusinato Apr 19, 2024
67ffc53
Added function description
MarcoCusinato Apr 19, 2024
f4b2c57
Removed comment ender
MarcoCusinato Apr 19, 2024
dcdccbd
Added and removed empty lines
MarcoCusinato Apr 19, 2024
f508f26
Update pycbc_pygrb_page_tables
pannarale Apr 19, 2024
541ebd5
Removed unused import
MarcoCusinato Apr 19, 2024
d5084dc
Merge branch 'page-tables-s' of https://github.com/MarcoCusinato/pycb…
MarcoCusinato Apr 19, 2024
2548b44
Merge branch 'master' into page-tables-s
pannarale Apr 19, 2024
870b12b
Fixed issue with slide_id
MarcoCusinato Apr 22, 2024
c08ebc7
Addressed issues with hdf arrays slicing
MarcoCusinato Apr 22, 2024
6cf62b1
Addressed dictionary key issues
MarcoCusinato Apr 22, 2024
2372b97
Update bin/pygrb/pycbc_pygrb_page_tables
MarcoCusinato Apr 22, 2024
0ab5b99
Update bin/pygrb/pycbc_pygrb_page_tables
MarcoCusinato Apr 22, 2024
bcd3995
Used reweightedsnr_cut
MarcoCusinato Apr 22, 2024
f26030f
Addressed codeclimate
MarcoCusinato Apr 22, 2024
531ceaa
Removed trig_data from load_missed function
MarcoCusinato Apr 23, 2024
5ce2e51
Removed comments
MarcoCusinato Apr 23, 2024
4ba067e
Changed bank file file name
MarcoCusinato Apr 23, 2024
dbecfbc
Removed try
MarcoCusinato Apr 23, 2024
988df8b
Added Delta t column
MarcoCusinato Apr 23, 2024
4ca6c34
Added Delta t column
MarcoCusinato Apr 23, 2024
b75e9b5
Cleaned unused options
MarcoCusinato Apr 23, 2024
66fe422
Removed bestnr options
MarcoCusinato Apr 23, 2024
e08ba85
Cleaned stored options
MarcoCusinato Apr 23, 2024
d601164
Corrected typo
MarcoCusinato Apr 23, 2024
9d30049
Update bin/pygrb/pycbc_pygrb_page_tables
MarcoCusinato Apr 23, 2024
07a90b4
Removed duplicate print
MarcoCusinato Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 79 additions & 39 deletions bin/pycbc_multi_inspiral
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ from pycbc.filter import MatchedFilterControl
from pycbc.types import TimeSeries, zeros, float32, complex64
from pycbc.types import MultiDetOptionAction
from pycbc.vetoes import sgchisq

from pycbc.conversions import mchirp_from_mass1_mass2

# The following block of lines sets up the command-line interface (CLI) for the
# pycbc_multi_inspiral executable.
Expand Down Expand Up @@ -335,8 +335,13 @@ with ctx:
'null_snr': float32,
'nifo': int,
'my_network_chisq': float32,
'my_network_bank_chisq': float32,
'my_network_cont_chisq': float32,
'reweighted_snr': float32,
'slide_id': int
'slide_id': int,
'mass1': float32,
'mass2': float,
'mchirp': float
}
network_out_vals = {
'dec': None,
Expand All @@ -346,8 +351,13 @@ with ctx:
'null_snr': None,
'nifo': None,
'my_network_chisq': None,
'my_network_bank_chisq': None,
'my_network_cont_chisq': None,
'reweighted_snr': None,
'slide_id': None
'slide_id': None,
'mass1': None,
'mass2': None,
'mchirp': None
}
network_names = sorted(network_out_vals.keys())
event_mgr = EventManagerCoherent(
Expand Down Expand Up @@ -392,6 +402,9 @@ with ctx:
# Loop over templates
for t_num, template in enumerate(bank):
# Loop over segments
m1 = bank.table['mass1'][t_num]
m2 = bank.table['mass2'][t_num]
mchirp = mchirp_from_mass1_mass2(m1, m2)
for s_num,stilde in enumerate(segments[args.instruments[0]]):
stilde = {ifo : segments[ifo][s_num] for ifo in args.instruments}
# Filter check checks the 'inj_filter_rejector' options to
Expand Down Expand Up @@ -602,59 +615,52 @@ with ctx:
# Calculate the power and autochi2 values for the coinc
# indexes (this uses the snr timeseries before the time
# delay, so we need to undo it. Same for normalisation)
# Need all out vals to be the same length.
# This means the entries that are single values
# need to be repeated once per event.
num_events = None
# Disctionaries for the degrees of freedom and chisqs
# these are used to compute the network chisqs
chisq = {}
chisq_dof = {}
chisq_bank = {}
chisq_bank_dof = {}
chisq_cont = {}
chisq_cont_dof = {}
for ifo in args.instruments:
# Chisqs
chisq[ifo], chisq_dof[ifo] = power_chisq.values(
corr_dict[ifo],
coherent_ifo_trigs[ifo] / norm_dict[ifo],
norm_dict[ifo], stilde[ifo].psd,
coinc_idx_det_frame[ifo]
+ stilde[ifo].analyze.start,
template)
# Calculate network chisq value
network_chisq_dict = coh.network_chisq(
chisq, chisq_dof, coherent_ifo_trigs)
# Calculate chisq reweighted SNR
if nifo > 2:
reweighted_snr = ranking.newsnr(
rho_coh, network_chisq_dict)
# Calculate null reweighted SNR
reweighted_snr = coh.reweight_snr_by_null(
reweighted_snr, null, rho_coh)
elif nifo == 2:
reweighted_snr = ranking.newsnr(
rho_coinc, network_chisq_dict)
else:
rho_sngl = abs(
snr[args.instruments[0]][
coinc_idx_det_frame[args.instruments[0]]
]
)
reweighted_snr = ranking.newsnr(
rho_sngl, network_chisq_dict)
# Need all out vals to be the same length. This means
# the entries that are single values need to be
# repeated once per event.
num_events = len(reweighted_snr)
# the output will only be possible if
# len(networkchi2) == num_events
for ifo in args.instruments:
(ifo_out_vals['bank_chisq'],
ifo_out_vals['bank_chisq_dof']) =\
chisq_bank[ifo], chisq_bank_dof[ifo] = \
bank_chisq.values(
template, stilde[ifo].psd, stilde[ifo],
coherent_ifo_trigs[ifo] / norm_dict[ifo],
norm_dict[ifo],
coinc_idx_det_frame[ifo]
+ stilde[ifo].analyze.start)
ifo_out_vals['cont_chisq'] = autochisq.values(
chisq_cont[ifo] = autochisq.values(
snr_dict[ifo] / norm_dict[ifo],
coinc_idx_det_frame[ifo], template,
stilde[ifo].psd, norm_dict[ifo],
stilde=stilde[ifo], low_frequency_cutoff=flow)
ifo_out_vals['chisq'] = chisq[ifo]
ifo_out_vals['chisq_dof'] = chisq_dof[ifo]
#chisq_cont_dof[ifo] = getattr(autochisq, 'dof')
# Number of events
if num_events is None:
num_events = len(chisq[ifo])
# Assign out_vals
(ifo_out_vals['chisq'],
ifo_out_vals['chisq_dof']) = \
(chisq[ifo], chisq_dof[ifo])
(ifo_out_vals['bank_chisq'],
ifo_out_vals['bank_chisq_dof']) = \
(chisq_bank[ifo], chisq_bank_dof[ifo])
ifo_out_vals['cont_chisq'] = chisq_cont[ifo]
print(ifo_out_vals['cont_chisq'])
ifo_out_vals['time_index'] = (
coinc_idx_det_frame[ifo]
+ stilde[ifo].cumulative_index
Expand All @@ -669,22 +675,56 @@ with ctx:
event_mgr.add_template_events_to_ifo(
ifo, ifo_names,
[ifo_out_vals[n] for n in ifo_names])
if nifo>2:
# Calculate network, network bank and network cont chisq values
network_chisq_dict = coh.network_chisq(
chisq, chisq_dof, coherent_ifo_trigs)
# NOTE: not implemented yet
#network_chisq_bank_dict = coh.network_chisq(
# chisq_bank, chisq_bank_dof, coherent_ifo_trigs)
#network_chisq_cont_dict = coh.network_chisq(
# chisq_cont, chisq_cont_dof, coherent_ifo_trigs)
# Calculate chisq reweighted SNR
if nifo > 2:
reweighted_snr = ranking.newsnr(
rho_coh, network_chisq_dict)
# Calculate null reweighted SNR
reweighted_snr = coh.reweight_snr_by_null(
reweighted_snr, null, rho_coh)
network_out_vals['coherent_snr'] = rho_coh
network_out_vals['null_snr'] = null
elif nifo==2:
elif nifo == 2:
reweighted_snr = ranking.newsnr(
rho_coinc, network_chisq_dict)
network_out_vals['coherent_snr'] = rho_coinc
else:
rho_sngl = abs(
snr[args.instruments[0]][
coinc_idx_det_frame[args.instruments[0]]
]
)
reweighted_snr = ranking.newsnr(
rho_sngl, network_chisq_dict)
network_out_vals['coherent_snr'] = (
abs(snr[args.instruments[0]][
coinc_idx_det_frame[args.instruments[0]]
])
)
# Assign network values
network_out_vals['reweighted_snr'] = reweighted_snr
network_out_vals['my_network_chisq'] = (
np.real(network_chisq_dict))
# NOTE: not implemented yet
#network_out_vals['my_network_bank_chisq'] = (
# np.real(my_network_chisq_bank_dict)
#)
#network_out_vals['network_cont_chisq'] = (
# np.real(my_network_chisq_cont_dict)
#)
network_out_vals['time_index'] = (
coinc_idx + stilde[ifo].cumulative_index)
network_out_vals['mass1'] = [m1] * num_events
network_out_vals['mass2'] = [m2] * num_events
network_out_vals['mchirp'] = [mchirp] * num_events
network_out_vals['nifo'] = [nifo] * num_events
network_out_vals['dec'] = [sky_positions[1][position_index]] * num_events
network_out_vals['ra'] = [sky_positions[0][position_index]] * num_events
Expand All @@ -707,4 +747,4 @@ logging.info('Writing output')
event_mgr.write_events(args.output)

logging.info("Finished")
logging.info("Time to complete analysis: %d", int(time.time() - time_init))
logging.info("Time to complete analysis: %d", int(time.time() - time_init))
Loading
Loading