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

sbank v1.0.0 with IMRPhenomT* #43

Open
MariaAssiduo opened this issue Feb 11, 2022 · 11 comments
Open

sbank v1.0.0 with IMRPhenomT* #43

MariaAssiduo opened this issue Feb 11, 2022 · 11 comments

Comments

@MariaAssiduo
Copy link

Hi. I need to use the waveforms IMRPhenomTPHM/TP/THM/T to generate template banks with sbank. In conda igwn-py39- the version of lalsimulation seems to include this waveforms

lalsimulation.GetApproximantFromString("IMRPhenomTPHM") and others..

But I don't know how to use sbank with that waveforms. In case of the approximant IMRPhenomXPHM, I just modified sbank adding the following lines:

in waveforms.py:

class IMRPrecessingPhenomXPHMTemplate(IMRPrecessingSpinTemplate, HigherOrderModeTemplate):
    """Class for IMRPhenomXPHM templates"""
    approximant = "IMRPhenomXPHM"

waveforms = {
...
...
"IMRPhenomXPHM": IMRPrecessingPhenomXPHMTemplate,
}

in tau0tau3.py:

proposals = {
...
...
"IMRPhenomXPHM": double_spin_precessing_param_generator
}

And I was able to build template banks. In the case of IMRPhenomTPHM I did something similar, but it doesn't work (here a test /home/maria.assiduo/test_gwastro7/TB_TPHM. and I get the error:

Traceback (most recent call last):
  File "/home/maria.assiduo/gwastro7/sbank_Python3/bin/sbank_pipe", line 300, in <module>
    sbankJob = SBankJob(cp, tag_base=options.user_tag + "_sbank")
  File "/home/maria.assiduo/gwastro7/sbank_Python3/bin/sbank_pipe", line 91, in __init__
    inspiral.InspiralAnalysisJob.__init__(self,cp,sections,exec_name,extension)
  File "/home/maria.assiduo/gwastro7/sbank_Python3/lib/python3.6/site-packages/lalapps/inspiral.py", line 46, in __init__
    pipeline.AnalysisJob.__init__(self,cp,dax)
TypeError: __init__() takes 2 positional arguments but 3 were given

).

In the script waveforms.py there is no defined class for IMRPhenomTTemplate... does this mean that in the current sbank version is not implemented IMRPhenom class in time domain?
I am quite confused and need help to understand.
Thank you in advance.

@duncanmmacleod
Copy link
Member

@MariaAssiduo, I think the issue is that you are using lscsoft-glue version 3.0.1 (the latest), however lalapps is incompatible with that version; this was fixed by @spxiwh in https://git.ligo.org/lscsoft/lalsuite/-/merge_requests/1782, however that has not been released yet.

I think the easiest thing might be for you to install lscsoft-glue==2.0.0 until a new release of lalapps is completed.

@MariaAssiduo
Copy link
Author

@duncanmmacleod Thank you. Quick question, If I do the changes described here in the script /home/maria.assiduo/gwastro7/sbank_Python3/lib/python3.6/site-packages/lalapps/inspiral.py, should I be able to fix the issue? Actually I tried, but it failed.

@duncanmmacleod
Copy link
Member

Ok, you also need the changes from https://git.ligo.org/lscsoft/lalsuite/-/merge_requests/1694.

@MariaAssiduo
Copy link
Author

@duncanmmacleod I am unable to make those changes, because I can't find the appropriate scripts in my copy of sbank. But I am really confused, when I install sbank I don't install all needed modules separately. So, when I install the latest version of sbank with git clone, glue is installed automatically (I assume). Then I use the source /home/maria.assiduo/gwastro7/sbank_Python3/bin/activate . Where should I install lscsoft-glue==2.0.0 and how to call that version of glue when I use my source to call sbank? Is there a generic source of sbank which I could use in order to generate template banks with IMRPhenomT* waveforms? Sorry to bother.

@duncanmmacleod
Copy link
Member

To install lscsoft-glue==2.0.0:

source /home/maria.assiduo/gwastro7/sbank_Python3/bin/activate
python -m pip install lscsoft-glue==2.0.0

@MariaAssiduo
Copy link
Author

@duncanmmacleod Hi, thank you for your help.

After your suggestion I still get this error (CIT dir -> /home/maria.assiduo/test_gwastro7):

sbank: error: option --approximant: invalid choice: 'IMRPhenomTPHM' (choose from 'TaylorF2RedSpin', 'TaylorF2', 'IMRPhenomB', 'IMRPhenomC', 'IMRPhenomD', 'IMRPhenomP', 'IMRPhenomPv2', 'SEOBNRv2', 'SEOBNRv2_ROM_DoubleSpin', 'SEOBNRv2_ROM_DoubleSpin_HI', 'SEOBNRv4', 'SEOBNRv4_ROM', 'EOBNRv2', 'SpinTaylorT4', 'SpinTaylorT5', 'SpinTaylorF2', 'SpinTaylorT5Fourier', 'SEOBNRv3', 'EOBNRv2HM_ROM', 'EOBNRv2HM_ROM_AmpMax', 'EOBNRv2HM_ROM_PhaseMax')

I defined them in waveforms.py and tau0tau3.py in a similar way of the approximants IMRPhenomXPHM as I described in the first comment here, I use the latest version of sbank and also conda igwn-py39-20211019.

What am I missing?
Thank you in advance.

@spxiwh
Copy link
Collaborator

spxiwh commented Feb 22, 2022

@MariaAssiduo The --approximant option takes the list of available approximants from here:

https://github.com/gwastro/sbank/blob/master/sbank/waveforms.py#L1028

which is one of the places you state you have already changed. I would make sure that this change is in the installed code, and that you are sourcing the code you expect. Doing:

from sbank import waveforms
print (list(waveforms.waveforms.keys()))

should print everything in that block of code. If that fails, you can do:

from sbank import waveforms
print (waveforms.__file__)

to get the location of the waveforms.py file that is being used. Open that file up and check your new approximant is present.

@MariaAssiduo
Copy link
Author

@spxiwh I have error "command not found" when I type from sbank import waveforms. The others command lines fails too.
I call the source /home/maria.assiduo/gwastro7/sbank_Python3/bin/activate ,
and in the directory /home/maria.assiduo/gwastro7/sbank/sbank/ if I do emacs waveforms.py, there are the changes I made for adding the approximants IMRPhenomTPHM.

Thank you

@spxiwh
Copy link
Collaborator

spxiwh commented Feb 24, 2022

@MariaAssiduo I think that "command not found" indicates this is being run directly from the command line and not from within python. My apologies, I should have stated that. Before running any of this you should run:

python

to open up a python prompt and then run these commands there. (Better to do this from the directory /home/maria.assiduo to avoid any potential issues of picking up files in the directory you are in).

@MariaAssiduo
Copy link
Author

MariaAssiduo commented Feb 24, 2022

@spxiwh Sorry, I did it and seems that the approximants are not properly added in sbank because they do not appear in the list

[maria.assiduo@ldas-pcdev14 ~]$ !sou
source /home/maria.assiduo/gwastro7/sbank_Python3/bin/activate
(sbank_Python3) [maria.assiduo@ldas-pcdev14 ~]$ python
Python 3.6.8 (default, Nov 10 2020, 07:30:01) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sbank import waveforms
>>> print (list(waveforms.waveforms.keys()))
['TaylorF2RedSpin', 'TaylorF2', 'IMRPhenomB', 'IMRPhenomC', 'IMRPhenomD', 'IMRPhenomP', 'IMRPhenomPv2', 'SEOBNRv2', 'SEOBNRv2_ROM_DoubleSpin', 'SEOBNRv2_ROM_DoubleSpin_HI', 'SEOBNRv4', 'SEOBNRv4_ROM', 'EOBNRv2', 'SpinTaylorT4', 'SpinTaylorT5', 'SpinTaylorF2', 'SpinTaylorT5Fourier', 'SEOBNRv3', 'EOBNRv2HM_ROM', 'EOBNRv2HM_ROM_AmpMax', 'EOBNRv2HM_ROM_PhaseMax']

>>> print (list(waveforms.waveforms.keys(IMRPhenomTPHM)))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'IMRPhenomTPHM' is not defined

Thank you

@spxiwh
Copy link
Collaborator

spxiwh commented Feb 24, 2022

Okay, so if you do:

from sbank import waveforms
print (waveforms.__file__)

from with a python shell, and then emacs the file indicated, are your changes there? If not you might not have correctly installed sbank after making your changes. (pip install . in the sbank directory after having sourced your code).

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

No branches or pull requests

3 participants