Comments (1)
this code might help, thanks to Patrick for this example
# makes the spectrum tally
energy_filter = openmc.EnergyFilter.from_group_structure('CASMO-70')
spectrum_tally = openmc.Tally(name="spectrum tally")
spectrum_tally.filters = [energy_filter]
spectrum_tally.scores = ['flux']
# gets the tally result
with openmc.StatePoint(sp_filename) as statepoint:
spectrum_tally_out = statepoint.get_tally(id=spectrum_tally.id)
# gets the bin
bin_boundaries = np.unique(energy_filter.bins).copy()
bin_boundaries[0] = 1e-10
flux = spectrum_tally_out.mean.flatten() # particle / source
# need to normalize flux by the log-width of the energy bins
log_de = np.log10(bin_boundaries[1:]/bin_boundaries[:-1])
flux = flux / log_de
plt.step(np.unique(energy_filter.bins)[:-1], flux)
plt.xscale('log')
plt.show()
from spectrum_plotter.
Related Issues (10)
- remove dependencies from CI
- Add a test for volume
- add option for plotly HOT 1
- Unable to plot spectra on surface HOT 2
- error plotting when spectrum has gaps (zero value error) HOT 3
- plotly and matplotlib plots are not identical
- pip install does not get all dependencies HOT 3
- making openmc convertor optional HOT 3
- process std dev correctly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spectrum_plotter.