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

TypeError: 'NoneType' when running pycbc_inspiral for gw150914 #4753

Open
BeltMarDani opened this issue May 17, 2024 · 4 comments
Open

TypeError: 'NoneType' when running pycbc_inspiral for gw150914 #4753

BeltMarDani opened this issue May 17, 2024 · 4 comments

Comments

@BeltMarDani
Copy link

Hi, I am trying to reproduce results from pycbc/examples/gw150914 via command lines and instead of running the notebook I just run pycbc_inspiral from the terminal. Appears that, with the same arguments as the ipynb example, I am returned:

pycbc_inspiral --verbose --approximant SEOBNRv2 --order 1 --taper-template start --bank-file H1L1-GW150914_BANK-1126051217-3331800.xml --pad-data 8 --sample-rate 4096 --strain-high-pass 20 --segment-length 256 --segment-start-pad 112 --segment-end-pad 16 --psd-estimation median --psd-segment-stride 8 --psd-segment-length 16 --psd-inverse-length 16 --low-frequency-cutoff 25 --trig-start-time 1126259430 --trig-end-time 1126259494 --chisq-bins '0.4*get_freq('fSEOBNRv2Peak',params.mass1,params.mass2,params.spin1z,params.spin2z)**(2./3.)' --snr-threshold 5.5 --newsnr-threshold 5 --cluster-window 4 --cluster-function symmetric --injection-window 4.5 --filter-inj-only --processing-scheme cpu --frame-files H-H1_LOSC_16_V2-1126257414-4096.gwf --channel-name H1:LOSC-STRAIN --gps-start-time 1126257636 --gps-end-time 1126259684 --gating-file H1-gating_C01_SNR300-1126051217-1129383017.txt.gz --output H1-INSPIRAL_FULL_DATA_JOB0-1126257771-1837.hdf
2024-05-17T15:05:49.177+02:00 Running with CPU support: 1 threads
2024-05-17T15:05:49.177+02:00 Reading Frames
2024-05-17T15:06:55.037+02:00 Highpass Filtering
2024-05-17T15:07:01.827+02:00 Resampling data
2024-05-17T15:09:45.834+02:00 Converting to float32
2024-05-17T15:09:45.895+02:00 Gating times contained in gating file
2024-05-17T15:09:45.962+02:00 Highpass Filtering
2024-05-17T15:09:47.385+02:00 Remove Padding
2024-05-17T15:09:47.386+02:00 Making frequency-domain data segments
2024-05-17T15:09:48.328+02:00 You are using the class-based PyCBC FFT API, with the numpy backed. This is provided for convenience only. If performance is important use the class-based API with one of the other backends (for e.g. MKL or FFTW)
2024-05-17T15:09:48.329+02:00 Overwhitening frequency-domain data segments
2024-05-17T15:09:48.333+02:00 Read in template bank
2024-05-17T15:09:48.656+02:00 Full template bank size: 1
2024-05-17T15:09:48.657+02:00 Template bank size after thinning: 1
2024-05-17T15:09:48.658+02:00 0: generating SEOBNRv2 from 25.0 Hz
2024-05-17T15:09:49.600+02:00 Filtering template 1/1 segment 1/1
2024-05-17T15:09:49.751+02:00 2 points above threshold
Traceback (most recent call last):
  File ".envPy/bin/pycbc_inspiral", line 467, in <module>
    data = list(mmap(template_triggers, tchunk))
  File ".envPy/bin/pycbc_inspiral", line 273, in template_triggers
    power_chisq.values(corr, snrv, norm, stilde.psd,
  File ".envPy/lib/python3.10/site-packages/pycbc/vetoes/chisq.py", line 386, in values
    bins = self.cached_chisq_bins(template, psd)
  File ".envPy/lib/python3.10/site-packages/pycbc/vetoes/chisq.py", line 340, in cached_chisq_bins
    num_bins = int(self.parse_option(template, self.num_bins))
  File ".envPy/lib/python3.10/site-packages/pycbc/vetoes/chisq.py", line 326, in parse_option
    return eval(arg, {"__builtins__":None}, safe_dict)
  File "<string>", line 1, in <module>
TypeError: 'NoneType' object is not subscriptable

I installed PyCBC following the guide and I am running the code in my own python virtual environment. Thanks.

@ahnitz
Copy link
Member

ahnitz commented May 17, 2024

@BeltMarDani Thanks this example may be out of date since the options to the code have evolved somewhat.

In the meantime, here's an example we include as part of the CI so I can guarantee works.

https://github.com/gwastro/pycbc/tree/master/examples/inspiral

@BeltMarDani
Copy link
Author

Hi, at least for me, this isn't working too.

>> [lun may 20 12:28:12 CEST 2024] Running pycbc inspiral fftw:openmp with 16 threads
usage: 
pycbc_inspiral: error: unrecognized arguments: --fftw-threads-backend openmp

If I remove the problematic argument, then the error remains:

>> [lun may 20 12:34:57 CEST 2024] Running pycbc inspiral fftw:openmp with 16 threads
usage: 
pycbc_inspiral: error: Backend fftw is not available
run.sh: line 42: --use-compressed-waveforms: command not found

If else I change --fft-backends to numpy , then the error is:

>> [lun may 20 12:41:33 CEST 2024] Running pycbc inspiral fftw:openmp with 16 threads
2024-05-20T12:41:44.524+02:00 You are using the class-based PyCBC FFT API, with the numpy backed. This is provided for convenience only. If performance is important use the class-based API with one of the other backends (for e.g. MKL or FFTW)
Traceback (most recent call last):
  File ".envPy/bin/pycbc_inspiral", line 439, in <module>
    bank = waveform.FilterBank(opt.bank_file, flen, delta_f,
  File ".envPy/lib/python3.10/site-packages/pycbc/waveform/bank.py", line 679, in __init__
    super(FilterBank, self).__init__(filename, approximant=approximant,
  File ".envPy/lib/python3.10/site-packages/pycbc/waveform/bank.py", line 266, in __init__
    ext = os.path.basename(filename)
  File "home/spack/spack/opt/spack/linux-rocky8-icelake/gcc-8.5.0/python-3.10.10-ze5tho3bqaggy3kl6uku3a3353sb37j6/lib/python3.10/posixpath.py", line 142, in basename
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
run.sh: line 42: --use-compressed-waveforms: command not found

Can you check if the code is working for you? Perhaps it is some issue concerning my PyCBC installation or something else.

@GarethCabournDavies
Copy link
Contributor

GarethCabournDavies commented Jun 11, 2024

run.sh: line 42: --use-compressed-waveforms: command not found means that the argument hasn't been given to the command, and bash is trying to run --use-compressed-waveforms as a command

I think the error above that is that no bank file has been supplied (this should be a required=True option rather than giving an obtuse error like this if it is required by default)

This leads me to think you missed a backslash in your .sh file when you went to a newline at some point (from doing this myself a lot!) - it could also be a space after a backslash in order to continue onto a newline

If you can confirm this is the case, we can add an issue/PR to give clearer errors in that case, and then close the issue

@BeltMarDani
Copy link
Author

Hi Gareth, thank you for your reply!
I checked that my input template bank is present in the directory where I am working, so the bank file is being supplied correctly.
Then I checked the backslashes and spacings (just in case) and unfortunately it still misses something. The error persists focusing in pycbc_inspiral: error: unrecognized arguments: --fftw-threads-backend ARGS where ARGS are openmp or pthreads.
Anyway, thank you for the suggestion.

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