gwastro / pycbc

Core package to analyze gravitational-wave data, find signals, and study their parameters. This package was used in the first direct detection of gravitational waves (GW150914), and is used in the ongoing analysis of LIGO/Virgo data.
http://pycbc.org
GNU General Public License v3.0
314 stars 351 forks source link

Allow pycbc pipeline to select a limited number of modes for NR injections #2278

Open juancalderonbustillo opened 6 years ago

juancalderonbustillo commented 6 years ago

Pycbc has the functionality of allowing to choose a limited number of modes from NR hdf files using the mode_array option of get_td_waveform.

However, I understand it is not possible to pass this argument for generating injections in the pycbc search pipeline. Could such a functionality be added? Alternatively, could anyone indicate which scripts should be modified?

Cyberface commented 6 years ago

If someone who knows how the pipeline works tells me what code to modify then I'm happy to help implement this with Juan

ahnitz commented 6 years ago

@juancalderonbustillo @Cyberface Let me break down what needs to happen here for this to work. There's a better long term solution involving the hdf format injections that Collin has started, but if you need this working quickly, I'll try to lay out a solution.

1) Manually generate your injection xml files 2) coopt a string field in the table and fill with your mode chose 3) choose some simple format such as "MODES=3-3,4-4" etc. 4) Modify the injection code to read this field and check if it contains a modes choice. If so, construct and pass on the modes argument to get_td_waveform.

This would involve modifying injection files by hand with a custom script and then editing one file in pycbc where we do the injections. That would be here.

https://github.com/gwastro/pycbc/blob/master/pycbc/inject/inject.py#L410

If you put in a block above the line there that looks at the 'inj' object which is a row of the xml table and then adds in the required keyword argument, that should be all. If you want to break the work between you someone can make the xml files and someone can make a patch for pycbc to interpret them. Fastest route I can think of.

Cyberface commented 6 years ago

@ahnitz thanks!!! @juancalderonbustillo how are the injection files created? Francesco Salemi was doing it right? :(

juancalderonbustillo commented 6 years ago

Yes, Francesco was doing it. However, he was already able to subselect some modes (I think choosing some max l), so I'd assume his script is already passing this kind of argument to the xml files.

juancalderonbustillo commented 6 years ago

This is the code:

https://git.ligo.org/imbhb/code/blob/master/injections/imbhinjNR.py

It contains a numrel_l_max and min arguments. This would need to be changed by some mode_array argument.

spxiwh commented 6 years ago

It would be simple to generate the mode_array from the numrel_l_max and min arguments. (Although I think this is not the ideal solution going forward, as you cannot specify arbitrary modes). If this is needed in the short term, does someone want to propose a patch?