[pycbc live] Allowing the use of template fits in the pycbc live ranking statistic
This PR contains the changes required in pycbc to allow the use of the trigger fit files in the pycbc live search. This does not contain the scripts necessary to create these trigger fits files.
Any comments and questions are very welcome and I can share the files I have created for testing these changes.
I'm going to get this branch to the state of passing the github tests (should be there now) and then run a small test to see if everything passes. This includes doing all the offline statmaps file creations because those are affected by the changes to the stat, I don't want to break any of the offline code
All of the changes made which reference the parameter mchirp or curr_mchirp are required for the ExpFitFgBgNormBBHStatistic statistic. I have moved the setting of self.curr_mchirp out of the other stat and into a new method rank_stat_coinc which explicitly sets this parameter and then runs the previous rank_stat_coinc from the non-BBH fits statistic. Thanks @GarethCabournDavies for helping me unpick that knot!
The test: run small search using pegasus + condor was failing repeatedly so I've trawled the logs to find out why.
- Failure:
- pegasus-plan_gw-main
- gw-main.dag.rescue001:
- Nodes that failed: 3
- pegasus-plan_ID0000073
- H1-SINGLES_MINIFOLLOWUP_FULL_DATA_VETOED-1186740100-3400
- page_snglinfo_ID0_ID0000001
- ERROR: Expected local file does not exist: /var/lib/condor/execute/dir_74309/pegasus.jACIXUYPs/H1-PAGE_SNGLINFO_FULL_DATA_VETOED_0-1186740100-3400.html
-
- pegasus-plan_ID0000079
- L1-SINGLES_MINIFOLLOWUP_FULL_DATA_VETOED-1186740100-3400
- page_snglinfo_ID0_ID000000
- pegasus-plan_ID0000085
- V1-SINGLES_MINIFOLLOWUP_FULL_DATA_VETOED-1186740100-3400
- page_snglinfo_ID0_ID0000001
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pycbc/events/stat.py", line 853, in find_fits
ifo = trigs.ifo
AttributeError: 'dict' object has no attribute 'ifo'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.8.18/x64/bin/pycbc_page_snglinfo", line 104, in <module>
sds = rank_method.single(sngl_file.trig_dict())
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pycbc/events/stat.py", line 1474, in single
sngl_stat = self.lognoiserate(trigs)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pycbc/events/stat.py", line 1443, in lognoiserate
alphai, ratei, thresh = self.find_fits(trigs)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pycbc/events/stat.py", line 855, in find_fits
ifo = trigs['ifo']
KeyError: 'ifo'
Originally the code has:
try:
tnum = trigs.template_num # exists if accessed via coinc_findtrigs
ifo = trigs.ifo
except AttributeError:
tnum = trigs['template_id'] # exists for SingleDetTriggers
assert len(self.ifos) == 1
# Should be exactly one ifo provided
ifo = self.ifos[0]
I've replaced it with:
try:
tnum = trigs.template_num
except AttributeError:
tnum = trigs['template_id']
try:
ifo = trigs.ifo
except AttributeError:
ifo = trigs.get('ifo', None)
if ifo is None:
ifo = self.ifos[0]
assert ifo in self.ifos
So if trigs doesn't have the ifo attribute or key then it falls back to the original way the code has identified the ifo currently used. There is now a missing assert len(self.ifos) == 1 but we shall see if the test runs through now before adding it back.
I've just cherry-picked a commit from master which should allow checks to progress more than they have, maybe that will fix things
I see all the required checks passed, happy to merge this
Just wanted to say thank you to everyone on this commit for getting this over the line while I was on holiday. Nice to see it finally merged!