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

Spectral extraction code #29

Open
dahlek opened this issue Jul 24, 2023 · 13 comments
Open

Spectral extraction code #29

dahlek opened this issue Jul 24, 2023 · 13 comments
Labels
enhancement New feature or request

Comments

@dahlek
Copy link

dahlek commented Jul 24, 2023

make a code that extracts spectra from images as a function of lat/long/mu, number of bins, etc.

@dahlek
Copy link
Author

dahlek commented Jul 24, 2023

hmu for my spectral extraction stuff made mostly from legacy Nemesis IDL programs

@emolter
Copy link
Owner

emolter commented Jul 26, 2023

Hi @dahlek , thanks for submitting this PR! This is something we would love to include in pylanetary. If I understand correctly what this piece of code would do, it would take in a lat-lon or emission angle range of interest, and then make an average spectrum within that range. Is that right? If so, this could definitely take advantage of the navigation.ModelBody class for doing the lat/lon/mu geometry. We have been wanting to improve support for spectral cubes for a while now, and it would be awesome if you could help with that. @sloughran97 is starting to work on extracting Doppler winds and has started a new namespace called pylanetary.spectral, so if you make support for spectral cubes you could use the same. Perhaps you could keep each other in the loop as you start to implement support for spectral cubes?

@dahlek
Copy link
Author

dahlek commented Jul 26, 2023

Sounds good! I'm new to collaborating on github but I'll see if I can't pull together a bit of a rough draft.

@emolter
Copy link
Owner

emolter commented Jul 26, 2023

cool let me know if you want to discuss how to implement this in detail, or the workflows with git

@dahlek
Copy link
Author

dahlek commented Aug 9, 2023

@emolter starting a draft version of this, for now meant to help a student extract spectra from SpeX images but I'm planning on keeping things as generic as possible/keeping track of the things to change: https://github.com/dahlek/spextraction

@emolter
Copy link
Owner

emolter commented Aug 10, 2023

sounds great! although I don't see any code on the GitHub page yet. @sloughran97 has started working on generic spectrum tools on a fork of the pylanetary repo, but I don't think a draft has been publicly uploaded yet. I'll ping her and see if she is willing to open a draft pull request; it might save you some work getting your tool working for your student.

@emolter
Copy link
Owner

emolter commented Aug 10, 2023

Here is Sarah's fork

@sloughran97
Copy link

Let me know if you have any questions! I think it'll be great to collaborate on the spectral extraction utilities.

@dahlek
Copy link
Author

dahlek commented Aug 10, 2023

Hey @sloughran97, looks like your fork mostly contains code to fit a line shape. I'm working on something to extract spectra of a given type (e.g. disk-averaged, binned, etc.) from an image, put it in user-defined units (e.g. I/F or radiance), and put it into a desired format to be used as input for something (for now it'll just be nemesis). Were you working on something similar? Or are there parts of your current fork that should be used for that? If so we should make sure we don't reinvent each other's wheels; otherwise I'll cruise ahead with "spextraction"

@dahlek
Copy link
Author

dahlek commented Aug 10, 2023

Mostly I need to write this anyways for a student at JPL, so once it's done we can see how/if we can merge stuff together

@sloughran97
Copy link

sloughran97 commented Aug 10, 2023 via email

@emolter emolter added the enhancement New feature or request label Aug 10, 2023
@emolter
Copy link
Owner

emolter commented Aug 11, 2023

@dahlek for spatial averaging of a spectrum, you may want to make use of utils.convolve_with_beam, which allows convolution of a 2-D field with a 2-D Gaussian or arbitrary PSF. We also already have a function for computing I/F from erg s-1 cm-2 um-1.

@dahlek
Copy link
Author

dahlek commented Aug 16, 2023

@emolter okay excellent, will do. One small comment, dunno if it's worth a whole fork, it would be good to mention on line 301 in utils that the fluxes for I/F should be calibrated already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants