astropy / astropy-tutorials

Tutorials for the Astropy Project
BSD 3-Clause "New" or "Revised" License
294 stars 177 forks source link

Spectroscopic data reduction tutorials #465

Open keflavich opened 4 years ago

keflavich commented 4 years ago

See https://github.com/astropy/astropy-tutorials/pull/464

https://colab.research.google.com/github/keflavich/AST4723-Public-Materials/blob/master/spectroscopy/Spectroscopic%20Trace%20Tutorial.ipynb https://colab.research.google.com/github/keflavich/AST4723-Public-Materials/blob/master/spectroscopy/Wavelength%20Calibration.ipynb https://colab.research.google.com/github/keflavich/AST4723-Public-Materials/blob/master/spectroscopy/Trace%2C%20Extract%2C%20Wavelength-Calibrate%20a%20spectrum%2C%20then%20do%20stuff.ipynb

I've written a 3-part tutorial:

(1) Spectroscopic Tracing (2) Wavelength Calibration (3) Put it together and calculate the EQW

The data set is included in the form of 5 .bmp files (bitmap), since apparently these spectra were taken by a camera that spits out that format. The total size is too big - each .bmp is 1.6 MB.

These were written as lecture material for a class targeted at senior undergraduates (analogous to Stuart Littlefair's PHY217). It therefore includes some additional analysis that isn't strictly necessary for a technical tutorial.

The wavelength catalog selection using NIST data reveals some flaws in the astroquery interface, but they're simple enough to overcome so I haven't raised an issue yet... NIST tables are just not meant to be machine-read.

kelle commented 4 years ago

These tutorials need just a bit of work to expand the text and get them in the format of Astropy Tutorials. A lot of the text could be copied and pasted from the Massey guide guide. If you or anybody you know would be able to do this, please get in touch!

keflavich commented 4 years ago

The Wavelength Calibration has been updated to include an effective reimplementation of IRAF's reidentify & a 2D wl(x,y) solution

aaastorrs commented 3 years ago

Working through the wavelength calibration. What package is linfit_wlmodel.inverse in? Thanks!

keflavich commented 3 years ago

It's supposed to be made from something like this:

linfit_wlmodel_hgkrne = linfitter(model=wlmodel, x=xvals_hg_plus_kr_plus_ne, y=waves_hg_plus_kr_plus_ne)

but it looks like some cells are missing? I'm confused; these notebooks used to run standalone.

aaastorrs commented 3 years ago

Thanks so much for getting back to me! There does indeed seem to be some stuff missing-I attach a screenshot of where things go crosswise for me. Some suspiciously blank lines... -Alex

@.***D71B3E.7AE884E0]

From: Adam Ginsburg @.> Sent: Tuesday, March 16, 2021 11:32 PM To: astropy/astropy-tutorials @.> Cc: Storrs, Alex @.>; Comment @.> Subject: Re: [astropy/astropy-tutorials] Spectroscopic data reduction tutorials (#465)

[EXTERNAL EMAIL - USE CAUTION]

It's supposed to be made from something like this:

linfit_wlmodel_hgkrne = linfitter(model=wlmodel, x=xvals_hg_plus_kr_plus_ne, y=waves_hg_plus_kr_plus_ne)

but it looks like some cells are missing? I'm confused; these notebooks used to run standalone.

- You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fastropy%2Fastropy-tutorials%2Fissues%2F465%23issuecomment-800766633&data=04%7C01%7Castorrs%40towson.edu%7C23796b5c2c454797a77b08d8e8f53634%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637515487600308788%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2F6tudINOgmkPCbaKyjjHMuL8MYTxdkcGKBha7RCb3zE%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FATIOZFDEFGMAZPNG67IE4PTTEAPCPANCNFSM4TCM5EIA&data=04%7C01%7Castorrs%40towson.edu%7C23796b5c2c454797a77b08d8e8f53634%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637515487600308788%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=LGnVe0HxEmLy1hT4HP8ah71DhP3adNQt8nSI7vNqc%2FA%3D&reserved=0.

keflavich commented 3 years ago

Looks like a key cell accidentally got deleted!

https://nbviewer.jupyter.org/github/keflavich/AST4723-Public-Materials/blob/978f0a8880476698618c0724098825a31db8d248/spectroscopy/Wavelength%20Calibration.ipynb

Look at cell 24

keflavich commented 3 years ago

I just pushed a fix. I must have had the text selected and pressed "space" or something... this happens with browser-based editing =/

aaastorrs commented 3 years ago

As George Takei says, "Oh my!" Thanks for the fix, I'll try that on my data. -Alex

From: Adam Ginsburg @.> Sent: Wednesday, March 17, 2021 3:17 PM To: astropy/astropy-tutorials @.> Cc: Storrs, Alex @.>; Comment @.> Subject: Re: [astropy/astropy-tutorials] Spectroscopic data reduction tutorials (#465)

[EXTERNAL EMAIL - USE CAUTION]

I just pushed a fix. I must have had the text selected and pressed "space" or something... this happens with browser-based editing =/

- You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fastropy%2Fastropy-tutorials%2Fissues%2F465%23issuecomment-801344513&data=04%7C01%7Castorrs%40towson.edu%7Cb3fd3c7eb6344720047408d8e9794497%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637516054369310796%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=LBwcr6QkgXU%2BkCQLLZPxiAoSgpEQ8ifrnfpQSbvR5vc%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FATIOZFHHC3OTLT75URYSZWDTED53JANCNFSM4TCM5EIA&data=04%7C01%7Castorrs%40towson.edu%7Cb3fd3c7eb6344720047408d8e9794497%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637516054369320788%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=C0RyKp36szu%2FyQEEIqKTgxDFbyxfDZijKct4aZIcEkM%3D&reserved=0.

aaastorrs commented 3 years ago

That seems to fix it! Now, it looks like the NIST table for Ne has some odd relative intensity values-things like "50f", "70f", etc. Can I add something to the line

ne_keep = np.array(['*' not in x for x in neon_lines['Rel.']])

so that it will mask these out, as well as the asterisks?

Thanks!

-Alex

From: Adam Ginsburg @.> Sent: Wednesday, March 17, 2021 3:17 PM To: astropy/astropy-tutorials @.> Cc: Storrs, Alex @.>; Comment @.> Subject: Re: [astropy/astropy-tutorials] Spectroscopic data reduction tutorials (#465)

[EXTERNAL EMAIL - USE CAUTION]

I just pushed a fix. I must have had the text selected and pressed "space" or something... this happens with browser-based editing =/

- You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fastropy%2Fastropy-tutorials%2Fissues%2F465%23issuecomment-801344513&data=04%7C01%7Castorrs%40towson.edu%7Cb3fd3c7eb6344720047408d8e9794497%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637516054369310796%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=LBwcr6QkgXU%2BkCQLLZPxiAoSgpEQ8ifrnfpQSbvR5vc%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FATIOZFHHC3OTLT75URYSZWDTED53JANCNFSM4TCM5EIA&data=04%7C01%7Castorrs%40towson.edu%7Cb3fd3c7eb6344720047408d8e9794497%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637516054369320788%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=C0RyKp36szu%2FyQEEIqKTgxDFbyxfDZijKct4aZIcEkM%3D&reserved=0.

keflavich commented 3 years ago

might be worth posting a more extensive issue about that; if you're getting something different than I did, it may mean that NIST data formats have changed?

aaastorrs commented 3 years ago

I actually printed out the table, most of the numbers are fine. Occasionally an intensity number followed by “f” shows up, and Python can’t convert that to floating point. I’m such a beginner at Python that I don’t know how to strip these out, but it seems like a simple search should do it.

Thanks again!

-Alex

On Mar 17, 2021, at 4:39 PM, Adam Ginsburg @.***> wrote:

 [EXTERNAL EMAIL - USE CAUTION]

might be worth posting a more extensive issue about that; if you're getting something different than I did, it may mean that NIST data formats have changed?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fastropy%2Fastropy-tutorials%2Fissues%2F465%23issuecomment-801427829&data=04%7C01%7Castorrs%40towson.edu%7C4d9927be56d14ace0be008d8e984cbd7%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637516103861664871%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=L%2FWhSQ5TinIk5fScvrkVlUb8BlRSG4ooKBLKRno6fqI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FATIOZFDPHRQ6K3M4O3ZAH7LTEEHQ3ANCNFSM4TCM5EIA&data=04%7C01%7Castorrs%40towson.edu%7C4d9927be56d14ace0be008d8e984cbd7%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637516103861664871%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=AADvHvjMB%2Fi2C%2FDBoSu%2B676h72yc17j6tqTiV5lI%2FF4%3D&reserved=0.

aaastorrs commented 3 years ago

I just copied the terms you had to eliminate blank or asterisked lines until Python stopped giving me error messages. Thanks so much for putting this together! Python is now the fourth data reduction language I've had to learn, and clearly I have a ways to go...

Sincerely,

Alex

From: Adam Ginsburg @.> Sent: Wednesday, March 17, 2021 4:40 PM To: astropy/astropy-tutorials @.> Cc: Storrs, Alex @.>; Comment @.> Subject: Re: [astropy/astropy-tutorials] Spectroscopic data reduction tutorials (#465)

[EXTERNAL EMAIL - USE CAUTION] might be worth posting a more extensive issue about that; if you're getting something different than I did, it may mean that NIST data formats have changed?

- You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fastropy%2Fastropy-tutorials%2Fissues%2F465%23issuecomment-801427829&data=04%7C01%7Castorrs%40towson.edu%7C4d9927be56d14ace0be008d8e984cbd7%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637516103861664871%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=L%2FWhSQ5TinIk5fScvrkVlUb8BlRSG4ooKBLKRno6fqI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FATIOZFDPHRQ6K3M4O3ZAH7LTEEHQ3ANCNFSM4TCM5EIA&data=04%7C01%7Castorrs%40towson.edu%7C4d9927be56d14ace0be008d8e984cbd7%7Ccbf9739249f649dda8a619f710efcc35%7C0%7C0%7C637516103861664871%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=AADvHvjMB%2Fi2C%2FDBoSu%2B676h72yc17j6tqTiV5lI%2FF4%3D&reserved=0.