Skip to content
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

power: add flux calculation (number of points) #101

Open
srio opened this issue Mar 9, 2022 · 0 comments
Open

power: add flux calculation (number of points) #101

srio opened this issue Mar 9, 2022 · 0 comments
Assignees

Comments

@srio
Copy link
Member

srio commented Mar 9, 2022

See script in hercules tutorial

import numpy as np
from srxraylib.plot.gol import plot
import scipy.constants as codata
# this part is to read the incoming signals
energy = np.copy(in_object_1.get_contents("xoppy_data")[:,0])
pow_w_ev = np.copy(in_object_1.get_contents("xoppy_data")[:,-1])

#this transforms the power spectra in photons/s/eV
flux_in_bandwidth = (pow_w_ev/codata.e)/1000 
flux_ps_ev = flux_in_bandwidth / (energy / 1000)

#plotting part
plot(energy, flux_ps_ev, xlog=False, ylog=True, xtitle="Photon energy [eV]",ytitle="Flux", legend=["Flux(Ph/s/eV)"])
#calculation of the total number of photons/s
total_ph = np.trapz(flux_ps_ev, x=energy, axis = -1)

print(f'Total photons per second {total_ph:.5E} at 5000 eV')
@srio srio self-assigned this Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant