Skip to content

Conversation

@ColmTalbot
Copy link
Collaborator

@GregoryAshton this tracks back to the FisherMatrixPosteriorEstimator, I opted to update the parameters that are passed to the FMPE, rather than allowing it to just take a subset. I think this is more inline with the recent changes to the likelihood.

Traceback (most recent call last):
  File "/Users/ct6081/software/bilby/examples/gw_examples/injection_examples/fast_tutorial.py", line 117, in <module>
    result = bilby.run_sampler(
             ^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/core/sampler/__init__.py", line 314, in run_sampler
    result = sampler.run_sampler()
             ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/core/sampler/base_sampler.py", line 101, in wrapped
    output = method(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/bilby_mcmc/sampler.py", line 254, in run_sampler
    self.draw()
  File "/Users/ct6081/software/bilby/bilby/bilby_mcmc/sampler.py", line 341, in draw
    self.ptsampler.step_all_chains()
  File "/Users/ct6081/software/bilby/bilby/bilby_mcmc/sampler.py", line 812, in step_all_chains
    self.sampler_list[ii] = sampler.step()
                            ^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/bilby_mcmc/sampler.py", line 1276, in step
    prop, log_factor = proposal(
                       ^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/bilby_mcmc/proposals.py", line 139, in __call__
    sample, log_factor = self.propose(chain, likelihood, priors)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/bilby_mcmc/proposals.py", line 829, in propose
    self.iFIM = fmp.calculate_iFIM(sample.dict)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/core/fisher.py", line 60, in calculate_iFIM
    FIM = self.calculate_FIM(sample)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/core/fisher.py", line 88, in calculate_FIM
    FIM[ii, jj] = -self.get_second_order_derivative(sample, ii_key, jj_key)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/core/fisher.py", line 94, in get_second_order_derivative
    return self.get_finite_difference_xx(sample, ii)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/core/fisher.py", line 105, in get_finite_difference_xx
    loglp = self.log_likelihood(p)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/core/fisher.py", line 57, in log_likelihood
    return _safe_likelihood_call(self.likelihood, parameters)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/core/likelihood.py", line 46, in _safe_likelihood_call
    logl = method(parameters=parameters)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/gw/likelihood/base.py", line 892, in log_likelihood
    return self.log_likelihood_ratio(parameters=parameters) + self.noise_log_likelihood()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/gw/likelihood/base.py", line 414, in log_likelihood_ratio
    self.waveform_generator.frequency_domain_strain(parameters)
  File "/Users/ct6081/software/bilby/bilby/gw/waveform_generator.py", line 138, in frequency_domain_strain
    return self._calculate_strain(model=self.frequency_domain_source_model,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/gw/waveform_generator.py", line 195, in _calculate_strain
    parameters = self._format_parameters(parameters)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ct6081/software/bilby/bilby/gw/waveform_generator.py", line 272, in _format_parameters
    new_parameters.pop(key)
KeyError: 'a_2'

Closes #1011

@ColmTalbot ColmTalbot added bug Something isn't working <10 lines sampling Issues about sampling algorithms, their efficiency and robustness labels Oct 31, 2025
@ColmTalbot ColmTalbot added this to the 2.7.1 milestone Oct 31, 2025
@ColmTalbot ColmTalbot added this pull request to the merge queue Nov 3, 2025
Merged via the queue into bilby-dev:main with commit da78508 Nov 3, 2025
13 checks passed
@ColmTalbot ColmTalbot deleted the bug-fix-fisher-matrix branch November 3, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working sampling Issues about sampling algorithms, their efficiency and robustness <10 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fast_tutorial.py failing with bilby_mcmc

3 participants