-
-
Notifications
You must be signed in to change notification settings - Fork 40
[WIP] NIST strong line retrieval #29
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
Conversation
… more accurately represents the format.
…rns a pandas DataFrame in the same format as the webcrawler
looks like this and #30 cover some of the same ground. a few comments:
|
They do indeed roughly the same, my idea was to provide a "proof of concept" (if it can be called that) in order to contribute in the discussion. I agree that Regarding the convention for retrieving the data I would definitely go with I have created a quick example. import pandas as pd
data_neon = {'rel_int': [100,
80,
80,
90,
90],
'wavelength' : [2809.485,
2906.592,
2906.816,
2910.061,
2910.408],
'spectrum' : ['Ne II',
'Ne II',
'Ne II',
'Ne II',
'Ne II'],
'reference' : ['P71',
'P71',
'P71',
'P71',
'P71']}
df = pd.DataFrame(data=data_neon, columns=['rel_int',
'wavelength',
'spectrum',
'reference'])
# the DataFrame object
print("The DataFrame Object")
print(df)
# selecting the three most intense
print("Selecting the three most intense")
three_most_intense = df.sort_values('rel_int', ascending=False)
three_most_intense = three_most_intense[:3].sort_values('wavelength')
print(three_most_intense)
print('select between 2900 and 2910')
print(df[((df.wavelength > 2900) & (df.wavelength < 2910))])
|
i'm a big pandas fan, but i'll point out one big disadvantage that i just realized: lack of units support. even in your example, it's not clear if the wavelengths are in it also doesn't appear that units support is coming to pandas any time soon: pandas-dev/pandas#15698 to avoid headaches down the road, i think it's important that at least the wavelengths returned by line list utilities contain explicit metadata describing the wavelength units. this leaves either a |
hmm, for the sake of compatibility with the rest of the stack, imo |
I guess I should be closing this as well, based on the conclusion of #30 |
This PR is an example of how to load NIST data into pandas DataFrame.
I'm not sure if this qualifies for merging but should be useful for merging. Or give me useful feedback and I can improve it.
See #28
BeautifulSoup
but I usedHTMLParser
which is more low level I think.