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

Weird Plotting Glitch #132

Open
ericasaw opened this issue May 24, 2023 · 2 comments
Open

Weird Plotting Glitch #132

ericasaw opened this issue May 24, 2023 · 2 comments

Comments

@ericasaw
Copy link
Collaborator

Was working on plotting some IGRINS spectra order by order this morning and I found this weird glitch. When you execute a line like specs[0][order].normalize().plot() (where specs is a list of IGRINSSpectrumLists) the plotted spectrum for a particular order is nicely normalized, but if you initialize a matplotlib figure and subplot and instead execute specs[0][order].normalize().plot(ax = ax) the plotted order is not normalized. If instead you set your new axis equal to the plot for the normalized order (ax = specs[0][order].normalize().plot()) the order is normalized and you can change things about the plot like the title, range, etc. Thought it was kind of weird, is anyone else running into this?

@gully
Copy link
Member

gully commented May 24, 2023

My guess is this is a copy issue--- whether the .plot operates on a copy or a view of the original. As a workaround, I recommend making an intermediate spectrum:

temp_spec = specs[0][order].normalize()
temp_spec.plot(ax = ax)

or maybe even:

temp_spec = specs[0][order]
temp_spec = temp_spec.normalize()
temp_spec.plot(ax = ax)

Merely a workaround until a scrupulous look at how/whether intermediate copies are made. The copying behavior is a legacy of how specutils stores SpectrumCollections. Someday I'd like to get a specutils contributor to give a critical look at muler-- they'd probably have some good guidance.

@gully
Copy link
Member

gully commented Aug 4, 2023

Hi @ericasaw is this plotting glitch still an issue? If so, can you provide a minimal reproducible example, and which version of muler you are using?

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