Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib, json
- DEBUG = True
- #Inputs
- symbol = 'Zr'
- mass_number = '87m'
- reaction = 't,3He'
- url = "http://www.cross-section-plotter.com/array_xs_small.txt?_=1485105436306"
- response = urllib.urlopen(url)
- data = json.loads(response.read())['data']
- search_result = None
- for i,j in enumerate(data):
- if j[1] == symbol and j[2] == mass_number and j[3] == reaction:
- if DEBUG:
- print 'Debug: '+j
- search_result = j
- if search_result == None:
- print "Particle not found"
- exit(1)
- particle = search_result[3].split(',')[0]
- librarylc=search_result[5].split('<')[0].lower()
- mass_number_short = search_result[2]
- if mass_number_short == 'Natural':
- mass_number = '000'
- else:
- mass_number = mass_number_short
- MT_number = search_result[4]
- filename='data/'+particle+'/'+symbol+'/'+mass_number+'/'+librarylc+'/'+MT_number
- if DEBUG:
- print 'Debug: '+filename
- particle_url = 'http://www.cross-section-plotter.com/'+filename
- particle_response = urllib.urlopen(particle_url)
- if DEBUG:
- print '\n\n**** RESULT ***\n\n'
- print particle_response.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement