Coder Social home page Coder Social logo

Comments (7)

keflavich avatar keflavich commented on July 17, 2024

@shaileshahuja This is a simple 1D spectrum, but the FITS header has 3 degenerate axes. You can use wcs.sub to drop all but the spectral axis:

header = fits.getheader('10074-190_HCOp.fits')
data = fits.getdata('10074-190_HCOp.fits')
w = wcs.WCS(header)
spectral_axis = w.naxis - 1 - w.wcs.spec # w.wcs.spec is FITS-order, 0-indexed
w_spec = w.sub([wcs.WCSSUB_SPECTRAL])
# this is the general case
slices = [slice(None)] + [0 for i in range(w.naxis-1)]
spectrum = data.swapaxes(0,spectral_axis)[slices]
# in this case, this would work fine:
spectrum = data.squeeze()

pyspeckit's reader is non-general and simply assumes the first axis is the spectral one (with an override option).

from specutils.

shaileshahuja avatar shaileshahuja commented on July 17, 2024

Thanks @keflavich for your response. May I know where is this procedure to evaluate this kind of function defined? Any research paper?

from specutils.

keflavich avatar keflavich commented on July 17, 2024

The WCS features are recorded in the astropy docs. They derive from WCSlib. This isn't research-level stuff, it's definitions and standards.

from specutils.

shaileshahuja avatar shaileshahuja commented on July 17, 2024

Is there any place where this standard is defined? There are a lot of WCS keywords, and I am trying to find a place where these standard are detailed, including steps to follow to derive the world coordinates from logical coordinates

from specutils.

keflavich avatar keflavich commented on July 17, 2024

Yes!

The old IRAF standard is here:
http://iraf.noao.edu/projects/spectroscopy/formats/sptable.html

The FITS homepage is here:
http://fits.gsfc.nasa.gov/
especially Papers II and III; these actually define the standard officially:
http://fits.gsfc.nasa.gov/fits_wcs.html

I swear there was another link, but I can't find it right away...

from specutils.

wkerzendorf avatar wkerzendorf commented on July 17, 2024

So we figured out yesterday that most of the data contained in this file is described in http://www.aanda.org/index.php?option=com_article&access=bibcode&Itemid=129&bibcode=2006A%2526A...446..747GFUL - which I think settles this problem for now.

from specutils.

keflavich avatar keflavich commented on July 17, 2024

Yes, that's the "Paper III" I was referring to.

from specutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.