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

Add Gamera spectral model example #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gschwefer
Copy link

Hello everyone,

this PR contains an example of how to use the Gamera source modelling tool to fit spectra in gammapy.

There are essentially two ways, one is to subclass SpectralModel with a GameraSpectralModel, the other to use a TemplateNDSpectralModel

One Problem with this is that gamera is not pip installable, therefore the notebook can't just be run after installing the environment from the env.yml, it requires the extra installation of gamera. A link to the installation info i in the notebook, but of course this is not ideal. Do you have any other suggestions for how to deal with this?

Also, are there any figures you would like to see added to this notebook?

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Contributor

@registerrier registerrier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gschwefer . This is interesting but I think we have a practical issue here.

For this recipe to run, gamera must be installed via the conda environment here.This would require a much more complex scheme where the Action will git clone and make gamera before running the notebook...

@adonath
Copy link
Member

adonath commented Jun 28, 2024

@registerrier and @gschwefer I agree making pip install work with Gamera would be very helpful (see libgamera/GAMERA#6)

@maxnoe
Copy link
Member

maxnoe commented Jun 28, 2024

@adonath @registerrier We are trying to make that happen.

It should already work with:

pip install git+https://github.com/maxnoe/GAMERA@scikit-build

@registerrier
Copy link
Contributor

@adonath @registerrier We are trying to make that happen.

It should already work with:

pip install git+https://github.com/maxnoe/GAMERA@scikit-build

This is really cool @maxnoe !

I have first run mamba install gsl swig in a gammapy conda environment.
Then when calling pip install git+https://github.com/maxnoe/GAMERA@scikit-build, I have an error with:

 CMake Error at /private/var/folders/p2/l2vqhn_17zbghwxxwwdnvk0m0000gn/T/pip-build-env-nc41s2nw/normal/lib/python3.10/site-packages/cmake/data/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
        Could NOT find GSL (missing: GSL_INCLUDE_DIR GSL_LIBRARY) (found version
        "2.7.1")

I tried to set the env variable but it did not work. Any idea?

@maxnoe
Copy link
Member

maxnoe commented Jun 28, 2024

For compiling things in the conda env, also install the compilers package and make sure to deactivate / reactivate the env.

That makes sure everything is setup correctly for libraries to be found.

Side note: swig is not needed in the conda env, it's only a build time dependency and is installed in the build env automatically.

@registerrier
Copy link
Contributor

For compiling things in the conda env, also install the compilers package and make sure to deactivate / reactivate the env.

That makes sure everything is setup correctly for libraries to be found.

Side note: swig is not needed in the conda env, it's only a build time dependency and is installed in the build env automatically.

Thanks. It worked!

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

Successfully merging this pull request may close these issues.

4 participants