Skip to content

numpy-like assignation for Grid1f and Grid3f #536

@sergiohcdna

Description

@sergiohcdna

Please describe what you want to do with CRPropa and you currently can't
I need to compute several density grids for source sampling over large volumes. The grids are not, in principle, periodic. I calculate the values using numpy to save time. But assign the values to a CRpropa Grid1f is fast enough but it is not optimal for very large grids

Describe the solution you'd like
I would like to have a method similar to the index slicing in numpy for value assignment in Grid1f and Grid3f

Describe alternatives you've considered
Once I got the calculation of my PDFs over a grid with numpy (taking 2s at most using just a cunk approach), I do need to assign these values to a CRpropa Grid1f instance. For a grid with 512x512x512 cells, the total runtime is 2 minutes to create the CRpropa grid. That is not bad, but it is a bottleneck if I require a smaller step to estimate the cells. I've been considering a multiprocessing with shared memory approach (as I am assuming that Grid1f is not thread-safe and I already tested that the object cannot be pickled)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions