radiasoft / sirepo

Sirepo is a framework for scientific cloud computing. Try it out!
https://sirepo.com
Apache License 2.0
64 stars 32 forks source link

move srw unzip logic into standard srwl_bl module #5407

Closed moellep closed 4 weeks ago

moellep commented 1 year ago

For SRW simulation with a tabulated undulator zip file, the generated run.py file has a method:

def setup_magnetic_measurement_files(filename, v):
    # ...

This logic should be moved to the srwl_bl module to hide the complexity and could be called something like this:

    v.und_mfs, v.und_mdir = srwl_bl.unzip_magnetic_measurements(
        'input_files/magn_meas_chx.zip',
        v.fdir,
    )

This would allow that line to be commented out easily by a power user, and replaced with a magnetic measurements which already exist on the file system:

    # v.und_mfs, v.und_mdir = srwl_bl.unzip_magnetic_measurements(
    #     'input_files/magn_meas_chx.zip',
    #     v.fdir,
    # )
    v.und_mfs, v.und_mdir  = 'ivu20_chx_sum.txt', '/home/user/magn_meas/chx'

For this issue, a new PR should be submitted to srw repo with the new method.

ochubar commented 1 year ago

Yes. Note that some related functions may already exist in srwl_bl.py; I'll send my current version of this file by e-mail.