GregoryAshton / kookaburra

MIT License
4 stars 3 forks source link

`priors.SpikeAndSlab.rescale` calls missing method `test_valid_for_rescaling` #10

Open tycohen opened 7 months ago

tycohen commented 7 months ago

Running the example kb_single_pulse fake_data.txt -p 0 -s 5 -b 2 --plot-fit throws the error

line 34, in rescale
    self.test_valid_for_rescaling(val)
AttributeError: 'SpikeAndSlab' object has no attribute 'test_valid_for_rescaling'

Is this supposed to be an inherited method from bilby.core.prior.Prior? My version of bilby (1.2.1) does not contain this method.

Full traceback

Traceback (most recent call last):
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/bin/kb_single_pulse", line 8, in <module>
    sys.exit(main())
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/kookaburra/single_pulse.py", line 264, in main
    run_full_analysis(args, data, full_model, result_null)
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/kookaburra/single_pulse.py", line 167, in run_full_analysis
    **get_sampler_kwargs(args)
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/bilby/core/sampler/__init__.py", line 200, in run_sampler
    **kwargs,
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/bilby/core/sampler/emcee.py", line 96, in __init__
    **kwargs,
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/bilby/core/sampler/base_sampler.py", line 250, in __init__
    self._verify_parameters()
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/bilby/core/sampler/base_sampler.py", line 410, in _verify_parameters
    self.search_parameter_keys, size=1
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/bilby/core/prior/dict.py", line 398, in sample_subset_constrained_as_array
    samples_dict = self.sample_subset_constrained(keys=keys, size=size)
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/bilby/core/prior/dict.py", line 449, in sample_subset_constrained
    sample = self.sample_subset(keys=keys, size=size)
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/bilby/core/prior/dict.py", line 423, in sample_subset
    samples[key] = self[key].sample(size=size)
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/bilby/core/prior/base.py", line 127, in sample
    self.least_recently_sampled = self.rescale(np.random.uniform(0, 1, size))
  File "/lustre/aoc/students/tcohen/miniconda3/envs/pulse_shapes/lib/python3.7/site-packages/kookaburra/priors.py", line 34, in rescale
    self.test_valid_for_rescaling(val)
AttributeError: 'SpikeAndSlab' object has no attribute 'test_valid_for_rescaling'
tycohen commented 7 months ago

Just noticed this was fixed in 8f5aa1a, but maybe not in the version on PyPI?