Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add options to pycbc_create_injections for use with offline search codes #3415

Merged
merged 5 commits into from
Jan 6, 2021

Conversation

ahnitz
Copy link
Member

@ahnitz ahnitz commented Aug 11, 2020

This allows one to set start / end times instead of a number of injections to draw. This is the most common scenario for search workflows and is sufficient to enable pycbc_create_injections to produce reasonable files for use with the offline analysis. There may be a couple distributions that should also be added for simplicity, but I think even there most things can be done with inline transforms, etc.

Example config file and command line

[variable_params]
tc =

[static_params]
mass1 = 37
mass2 = 32
ra = 2.2
dec = -1.25
inclination = 2.5
coa_phase = 1.5
polarization = 1.75
distance = 100
f_ref = 20
f_lower = 18
approximant = IMRPhenomPv2
taper = start

[prior-tc]
name = uniform
min-tc = 180
max-tc = 200
pycbc_create_injections --verbose \
        --config-files test.ini \
        --gps-start-time 1000000000 \
        --gps-end-time   1000500000 \
        --seed 10 \
        --output-file injection.hdf \
        --variable-params-section variable_params \
        --static-params-section static_params \
        --dist-section prior \
        --force

Copy link
Contributor

@cdcapano cdcapano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finally adding this; it's been on the to-do list for way too long. What you did is clever. However, I'm not sure I like having tc being mangled like this. The meaning of tc in the config file is changing depending on what the command-line arguments are; that'll be a bit confusing for users I think.

How about just making this all command line? So, add a time-step argument and a delta-time argument, and use those for generating the times? Also add a check for a tc prior in the config file, printing a warning that it's being ignored.

@ahnitz
Copy link
Member Author

ahnitz commented Aug 26, 2020

@cdcapano I've just updated the code to raise an error if 'tc' is set in the config file.

However, I do think we want the time delay distribution set this way, so as a compromise I've just changed the name to 'time_delay' in the config file to avoid confusion with tc.

@ahnitz
Copy link
Member Author

ahnitz commented Aug 26, 2020

The config file would now look like

[variable_params]
time_delay =

[static_params]
mass1 = 37
mass2 = 32
ra = 2.2
dec = -1.25
inclination = 2.5
coa_phase = 1.5
polarization = 1.75
distance = 100
f_ref = 20
f_lower = 18
approximant = IMRPhenomPv2
taper = start

[prior-time_delay]
name = uniform
min-time_delay = 90
max-time_delay = 200

@ahnitz ahnitz requested a review from cdcapano August 26, 2020 16:18
@ahnitz
Copy link
Member Author

ahnitz commented Sep 1, 2020

@cdcapano Poke

@cdcapano
Copy link
Contributor

cdcapano commented Nov 9, 2020

@ahnitz poke

@ahnitz
Copy link
Member Author

ahnitz commented Jan 5, 2021

@cdcapano Please review again. I've moved everything to an option of the script directly as you've suggested to make it consistent. For now, I suspect this is good enough to cover most cases.

Copy link
Contributor

@cdcapano cdcapano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Only issues is you have none typo (see comment), which is what is causing one of the CI tests to fail. (I'm surprised code climate didn't catch it.) Anyway, once you fix that, feel free to merge.

bin/pycbc_create_injections Outdated Show resolved Hide resolved
@ahnitz ahnitz merged commit 2490255 into gwastro:master Jan 6, 2021
OliverEdy pushed a commit to OliverEdy/pycbc that referenced this pull request Apr 3, 2023
…des (gwastro#3415)

* inj

* extend pycbc_create_injections to work for search workflows

* update

* move options to script

* Update pycbc_create_injections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants