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

Likelihood scan() crashes if fix_src_pars=True #22

Open
ricrando opened this issue Nov 7, 2023 · 4 comments
Open

Likelihood scan() crashes if fix_src_pars=True #22

ricrando opened this issue Nov 7, 2023 · 4 comments
Assignees

Comments

@ricrando
Copy link
Contributor

ricrando commented Nov 7, 2023

There are 2 problems:
the first is a self.like.freePars() instead of just self.freePars():

File ".../AnalysisBase.py", line 795, in scan
    freePars = self.like.freePars(srcName)
AttributeError: 'BinnedAnalysis' object has no attribute 'like'

the second is a 0 instead of a False

File ".../AnalysisBase.py", line 796, in scan
   self.setFreeFlag(srcName, freePars, 0)
 File ".../AnalysisBase.py", line 712, in setFreeFlag
   src_spectrum.parameter(item.getName()).setFree(value)
 File ".../pyLikelihood.py", line 2505, in setFree
   return _pyLikelihood.Parameter_setFree(self, free)
TypeError: in method 'Parameter_setFree', argument 2 of type 'bool'
@ricrando
Copy link
Contributor Author

ricrando commented Nov 7, 2023

Pull request

@donhorner
Copy link

Do you have an example we can use as a test case?

@ricrando
Copy link
Contributor Author

ricrando commented Nov 8, 2023

Sure, here is a sample script using the datafiles in the binned likelihd tutorial:
https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/binned_likelihood_tutorial.html
The script:
doscan.py.txt

@joeastro
Copy link

joeastro commented Nov 8, 2023

I was able to reproduce both issues @ricrando found using the test case provided above, and the proposed fixes seem both sensible & solved the underlying issues. I recommend approving the request.

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

4 participants