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

PS map usage problem #628

Open
imereu opened this issue Jan 10, 2025 · 2 comments
Open

PS map usage problem #628

imereu opened this issue Jan 10, 2025 · 2 comments
Assignees

Comments

@imereu
Copy link

imereu commented Jan 10, 2025

Data Analysis Question

How could I solve this problem with PS map tool?

I use in my script the example suggested in fermipy page:

# Write the source model map (after performing the fit)
gta.write_model_map(model_name="model01")

# Generate the PS map
psmap = gta.psmap(ccmap='ccube_00.fits',mmap='mcube_model01_00.fits', make_plots=True, emin=100, emax=100000, nbinloge=15)

The result is this one:
2025-01-10 17:43:13 INFO GTBinnedAnalysis.write_model_map(): Generating model map for component 00.
Traceback (most recent call last):
File "/Users/isabellamereu/FAscript/scriptpy3/FAfup_3.3.8_py3.py", line 586, in
psmap = gta.psmap(ccmap='ccube_00.fits',mmap='mcube_model01_00.fits', make_plots=True, emin=100, emax=100000, nbinloge=15)
File "/Users/isabellamereu/opt/anaconda3/envs/fermipy/lib/python3.9/site-packages/fermipy/psmap.py", line 52, in psmap
config = schema.create_config(self.config['psmap'], **kwargs)
File "/Users/isabellamereu/opt/anaconda3/envs/fermipy/lib/python3.9/site-packages/fermipy/config.py", line 183, in create_config
validate_from_schema(config, self)
File "/Users/isabellamereu/opt/anaconda3/envs/fermipy/lib/python3.9/site-packages/fermipy/config.py", line 47, in validate_from_schema
raise KeyError('Invalid configuration key: %s' % k)
KeyError: 'Invalid configuration key: ccmap'

``

@MiltosMichailidis MiltosMichailidis self-assigned this Jan 10, 2025
@MiltosMichailidis
Copy link
Contributor

Thank you for your message.

Please use "cmap" instead of "ccmap" as the keyword argument for the PS map:
psmap = gta.psmap(cmap='ccube_00.fits',mmap='mcube_model01_00.fits', make_plots=True, emin=100, emax=100000, nbinloge=15)

This should resolve your issue. We will update the documentation to address this in due time.

@HealthyPear
Copy link

I'd like to take advantage of this issue (which I also just found out) to propose to not just fix then name of this option, but to add also a proper docstring to the method which does not correspond to what shown in the documentation (try gta.psmap?).

Also, I noticed that in the output of this method there is a config key which does not show the whole configuration used by the method, but only the values specified when it was called. Storing the whole configuration with all available options and their real defaults is more important because the documentation might be outdated or wrong about the names of the arguments and their default values like in this case.

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