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

XSpectrum1D: sort wavelengths #125

Merged
merged 9 commits into from
Dec 27, 2015
Merged

XSpectrum1D: sort wavelengths #125

merged 9 commits into from
Dec 27, 2015

Conversation

profxj
Copy link
Contributor

@profxj profxj commented Dec 22, 2015

and related arrays.
Fixes an issue with COS spectra.
Probably still not ideal

if sig is not None:
sig = sig[srt]
xspec1d = XSpectrum1D.from_array(uwave, u.Quantity(fx),
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems to do the job.

Suggestion: Wouldn't it be better to avoid code duplication and do the sorting only once? How about using a fixed naming convention for all the important attributes/parameters/arrays needed for defining XSpectrum1D and do the sorting and calling only once in the very latest stage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I wish. Unfortunately there are too many ways
to instantiate and I can't do anything about the WCS ones..

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better to overload from_array so that it wraps Spectrum1D.from_array, but adds a keyword option sort which is false by default. What do you think?

@ntejos
Copy link
Contributor

ntejos commented Dec 23, 2015

The changes related to AbsComponent tests look all good to me. Feel free to merge unless Neil says otherwise...

rnd = np.random.rand()
else:
rnd = 0.
iline.attrib['logN'] = 13.3 + rnd
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this change - I hate using random numbers in tests.

@nhmc
Copy link
Contributor

nhmc commented Dec 23, 2015

See my inline comment about maybe putting a sort option into from_array (also maybe from_tuple). After you've considered this, merge when ready.

@profxj
Copy link
Contributor Author

profxj commented Dec 23, 2015

I've modified from_tuple.

Could probably eliminate the changes from io.py if
we change the calls in there from from_array to from_tuple.
Ask and I'll do so.

I decided over-loading from_array was too dangerous..

@nhmc
Copy link
Contributor

nhmc commented Dec 24, 2015

Yes, let's use from_tuple in io.py to minimise changes there. Also can you make the sorting in from_tuple optional using a keyword? So it can be turned off for speed, if necessary.

@profxj
Copy link
Contributor Author

profxj commented Dec 24, 2015

Done.

@profxj
Copy link
Contributor Author

profxj commented Dec 24, 2015

Just merged with the continuum fitting PR.

@ntejos
Copy link
Contributor

ntejos commented Dec 26, 2015

Should this PR be closed then?

@profxj
Copy link
Contributor Author

profxj commented Dec 27, 2015

Please merge it

On December 26, 2015 2:39:04 PM PST, Nicolas Tejos notifications@github.com wrote:

Should this PR be closed then?


Reply to this email directly or view it on GitHub:
#125 (comment)

!DSPAM:826,567f171437321814726196!

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@nhmc
Copy link
Contributor

nhmc commented Dec 27, 2015

Merging.

nhmc added a commit that referenced this pull request Dec 27, 2015
XSpectrum1D: sort wavelengths
@nhmc nhmc merged commit bc3fe37 into linetools:master Dec 27, 2015
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.

None yet

3 participants