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

Spectrum's iterator with null values #29

Open
jortiz12 opened this issue Jul 13, 2022 · 2 comments
Open

Spectrum's iterator with null values #29

jortiz12 opened this issue Jul 13, 2022 · 2 comments

Comments

@jortiz12
Copy link

Dear MPDAF community,

I´m having problems when using the various "iterators" describe in the Interface for spectra, images and cubes section.

Making use of a datacube (edge-on galaxy IC 1533, already reduced by S. Comeron), whose white-image is shown below
imagen

, the loops using the spectrum's iterator (for instance) fails because some of the spaxels have no flux, as shown in figure above (I think). This is code from the Cube_object section (apologies but can´t insert in code format),
imagen

And this is the error I get,

imagen

Any quick workaround to get around this issue? I face this issue in other parts of the tutorial where iterators are used too.

Needless to say, many thanks in advance.

Kind Regards,
Jose

@saimn
Copy link
Member

saimn commented Jul 13, 2022

You could skip the spectra that are entirely masked (e.g. with sp.mask.all()).

@jortiz12
Copy link
Author

Thanks Simon.
I'd appreciate if could show mw how to modify this piece of code taking into account your suggestion.

cont1 = obj1.clone(data_init=np.empty, var_init=np.zeros)
for sp, co in zip(iter_spe(obj1), iter_spe(cont1)):
co[:] = sp.poly_spec(5)

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

2 participants