Skip to content

stats/inspiral_extrinsics.py : allow InspiralExtrinsic.time_phase_snr insrance...

Leo Tsukada requested to merge dtdphi_loading_fix into master

Currently, InspiralExtrinc class is implemented so that time_phase_snr attribute will never be overwritten once it gets instantiated, which leads to a confusing behavior see by the following test code Anarya tried.

CASE1:

from gstlal.stats import inspiral_extrinsics

trigger_time={'H1': 1239267098.4288173, 'V1': 1239267098.4545088}
trigger_snr={'H1': 5.5876904, 'V1': 4.5092444}
trigger_coa_phase={'H1': -0.19001281, 'V1': -1.0438095}
trigger_horizons={'H1': 439.71824669631513, 'V1': 201.64499896993163}

dtdphi_file='/home/anarya.ray/SoG/sel/captains_orders/share/inspiral_dtdphi_pdf.h5'

ext_obj1=inspiral_extrinsics.InspiralExtrinsics(('H1','L1','V1'),2,filename=dtdphi_file)
ext_obj2=inspiral_extrinsics.InspiralExtrinsics(('H1','V1'),2,filename=dtdphi_file)

print(ext_obj1.time_phase_snr(trigger_time,trigger_coa_phase,trigger_snr,trigger_horizons))
print(ext_obj2.time_phase_snr(trigger_time,trigger_coa_phase,trigger_snr,trigger_horizons))

output : 

[0.]
[0.]

CASE 2:

from gstlal.stats import inspiral_extrinsics

trigger_time={'H1': 1239267098.4288173, 'V1': 1239267098.4545088}
trigger_snr={'H1': 5.5876904, 'V1': 4.5092444}
trigger_coa_phase={'H1': -0.19001281, 'V1': -1.0438095}
trigger_horizons={'H1': 439.71824669631513, 'V1': 201.64499896993163}

dtdphi_file='/home/anarya.ray/SoG/sel/captains_orders/share/inspiral_dtdphi_pdf.h5'

ext_obj2=inspiral_extrinsics.InspiralExtrinsics(('H1','V1'),2,filename=dtdphi_file)
ext_obj1=inspiral_extrinsics.InspiralExtrinsics(('H1','L1','V1'),2,filename=dtdphi_file)

print(ext_obj1.time_phase_snr(trigger_time,trigger_coa_phase,trigger_snr,trigger_horizons))
print(ext_obj2.time_phase_snr(trigger_time,trigger_coa_phase,trigger_snr,trigger_horizons))

Output:

[ 0.02706455]
[ 0.02706455] 

This implementation is intended to save memory use for online mode where the identical InspiralExtrinsic gets instantiated multiple times through Frankenstein RankingStat class. This patch allows the instance to be overwritten in case we want to create another RankingStat instance with different ifo config and fix the behavior described above. But at the same time, it will still keep the reduced memory use.

I tested this with the same minimal test code as above and confirmed that works as expected.

Edited by Leo Tsukada

Merge request reports