Giter Club home page Giter Club logo

Comments (4)

rworrall-ukaea avatar rworrall-ukaea commented on July 26, 2024 1

Hi Tom, the values attribute works fine.

Thanks,

Ross

from pypact.

github-actions avatar github-actions commented on July 26, 2024

Congratulations for submitting your first issue on pypact. Thanks for contributing!

from pypact.

thomasms avatar thomasms commented on July 26, 2024

We could add a tolerance, but I think that would defeat the purpose of that API. The setValue is intended as a convenience method for simple fluxes i.e setting a monoenergetic flux as:

# will make a 14 MeV beam in 3 lines for 175 group
ff = pp.FluxesFile()
ff.setGroup(175)
ff.setValue(14.0e6, 1.0)

# to file
pp.to_file(ff, "fluxes")

or the other use case of setValue is to permute one or two bin values after setting a base spectrum i.e. doing total MC.

ff = pp.FluxesFile()
ff.setGroup(175)
ff.values = [.....]
# change the 14 MeV bin to 0.8
ff.setValue(14.0e6, 0.8)

# to file
pp.to_file(ff, "fluxes")

If you simply just want to set a complete spectrum (all the bins) just use the values attribute.
For example:

# an array of 175 values set or retrieved from somewhere else.
myvalues = [......]

ff = pp.FluxesFile()
ff.setGroup(175)
# values are not protected - can read & write
ff.values = myvalues

# to file
pp.to_file(ff, "fluxes")

Does this help with your use case?

from pypact.

thomasms avatar thomasms commented on July 26, 2024

But if you still want to add the tolerance, then please make a pull request :)

from pypact.

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.