Skip to content

Parse input distributions #58

@gsell

Description

@gsell

I'd like to add a small distribution reader, something like this:

> def emitted_dist(filename, names=['x', 'px','y','py','t','pz']):  
>     '''Read in particle distribution used   
>     in OPAL-T simulation. Used to describe the   
>     beam distribution as it leaves the cathode.'''  
>
>     dist = {} 
>     data = np.loadtxt(filename, skiprows=1) 
>     for i,name in enumerate(names): 
>         dist[name] = data[:,i]
>
>     return dist

However, the tools have gotten a lot more advanced since the last time I pushed anything.
Not sure this fits the current style, or where to add it.
New parser file for distributions?
Maybe this already exists and I missed it?


Migrated from GitLab
GitLab ID: 44
Source: https://gitlab.psi.ch/OPAL/pyOPALTools/-/issues/44
Original state: opened
Original author: ext-neveu_n

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature requestUsed to label a feature request in the issue tracker.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions