Created
May 15, 2015 12:38
-
-
Save wkerzendorf/3bc9b7f86226471e5b60 to your computer and use it in GitHub Desktop.
Download the photoabsorption cross section
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from bs4 import BeautifulSoup | |
| base_url = 'http://henke.lbl.gov/cgi-bin/pert_cgi.pl' | |
| def get_photo_absorption_cross_section(element_code, energy): | |
| data = requests.get(base_url, data=dict( | |
| Element=element_code, Energy=energy)) | |
| bs = BeautifulSoup(data.text) | |
| for item in bs.find_all('li'): | |
| if item.text.startswith('Photo'): | |
| return float(item.text.split(':')[1].strip().replace('cm^2/g', '')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment