EFerriss / Pynams

Python package for interpreting FTIR spectra of nominally anhydrous minerals (NAMs)
MIT License
13 stars 4 forks source link

Change line thickness on baseline and spectrum plots #13

Closed barthac closed 7 years ago

barthac commented 7 years ago

I find it difficult to see exactly where the baseline is hitting the spectrum because the blue line is so thick. Is there a keyword to change the thickness for spec.get_area_under_curve? I can do style = {'line width' : 1} for the show_baseline plots but this option doesn't exist for spec.get_area_under_curve.

Also, is there a way to do profile.get_area_under_curve since right now I have to loop over all the spectra in the profile.

whtowbin commented 7 years ago

prof.make_area_list(wn_low=3165, wn_high=3200) will make a list of areas in the profile. You can leave out the keywords if you don't want to select a sub area from your profile. If you use the key word "show_plot=True" you can make several figures that display the sub area you have selected. This is great if you have multiple peaks with the same baseline that you want to get the area for separately.

barthac commented 7 years ago

Ahh perfect, thanks!

whtowbin commented 7 years ago

If you want to do profiles normalized to the maximum value you can make your X positions prof.positions_microns and your Y positions prof.make_area_list(wn_low=3165, wn_high=3200)/max(prof.make_area_list(wn_low=3165, wn_high=3200)

barthac commented 7 years ago

Yeah that's what I've been doing, Elizabeth thought it would be good to include a keyword in there

EFerriss commented 7 years ago

Note in case you want the figure and axes handles for the plots showing the exact area returned to you: spectrum.get_area_under_curve(show_plot=True) returns 3 things: fig, ax, area, and when you do profile.make_area_list(), that just loops through all the spectra doing spectrum.get_area_curve() and gathers the resulting areas up into profile.areas.

I will make a keyword normalized (default=False) in profile.plot_area_profile to save you a tiny bit of hassle there.

EFerriss commented 7 years ago

Maybe the method names should be the same or similar for spectrum and profile, so spectrum.make_area() and profile.make_areas() instead of spectrum.get_area_under_curve() and profile.make_area_list(). Feelings?

EFerriss commented 7 years ago

Change in vocabulary made! Now spectrum.make_area() and profile.make_areas(). I will update the examples momentarily.