Code Monkey home page Code Monkey logo

Comments (10)

mccoys avatar mccoys commented on August 25, 2024

Please provide some more details on how your diagnostics where implemented and post-processed. As the two types of diagnostics process the same particles, they should match.

from smilei.

philmartin01 avatar philmartin01 commented on August 25, 2024

ParticleBinning diagnostic:

def angles:
return np.arctan2(particles.py, particles.px)
DiagParticleBinning(
name = 'neutron angle',
deposited_quantity = "weight",
every = every,
species = ["neutron"],
axes = [
[angles , -1*math.pi, math.pi, 360],
["ekin", 0., 50, 100, "edge_inclusive"]
]
)

And then to get spectrum I extracted the data and integrated across the appropriate angular bins. With TrackParticles, I output all variables and create a similar histogram with scipy.stats.binned_statistic_dd, something like:

stats_data = stats.binned_statistic_dd([Theta, En], values = wn, statistic = 'sum', bins=[theta_bins, energy_bins])

where Theta and energy were calculated from the tracked Px and Py components, and wn is the macroparticle weights.

from smilei.

mccoys avatar mccoys commented on August 25, 2024

My guess is that your method with tracked particles divides by different bin sizes than that done in happi for particle binning. As you are using a custom axis, it cannot know the geometry of your binning. It's just a guess

from smilei.

philmartin01 avatar philmartin01 commented on August 25, 2024

Bin sizes are the same for both tracking and particlebinning, so all energies would be affected equally when dividing by bin size, not just those <2.5 MeV. I cannot see anything strange with the weights, their values are broadly consistent above and below 2.5MeV, just that there are a significant number of tracked neutrons in that low energy range, perhaps that isn't being counted by the binning diag? Or their weights are calculated differently between the two diagnostics.

from smilei.

mccoys avatar mccoys commented on August 25, 2024

I have no clue what is going on here. The particle binning really just does a histogram and divides by the bin size which is indeed constant in your case.

Just in case you may want to check the raw data in the hdf5 file.

from smilei.

mccoys avatar mccoys commented on August 25, 2024

Just an idea that crossed my mind. You wrote "Theta and energy were calculated from the tracked Px and Py components". But there should be Pz as well for calculating the energy. Did you take it into account?

Another detail: what is the geometry, and what are boundary conditions?

from smilei.

philmartin01 avatar philmartin01 commented on August 25, 2024

Geometry is 2D, so I didn't output Pz component. Boundaries are silver-muller.

from smilei.

mccoys avatar mccoys commented on August 25, 2024

2d means x and y, but there is definitely a contribution from px.

I meant boundary conditions for particles

from smilei.

philmartin01 avatar philmartin01 commented on August 25, 2024

Ah ok, I can rerun the simulation outputting Pz components as well and test it out. Boundaries were open.

from smilei.

philmartin01 avatar philmartin01 commented on August 25, 2024

Hi, including the Pz component has resolved the issue, thanks!

from smilei.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.