ochubar / SRW

Synchrotron Radiation Workshop
Other
86 stars 70 forks source link

Fix imports and add CLI file viewer #44

Closed mrakitin closed 1 year ago

mrakitin commented 1 year ago

This pull request fixes more imports (missed from #42) to be able to use the srwpy.SRWLIB_ExampleViewDataFile.py data file viewer.

Also, this adds a convenient script to avoid a long line to execute it

$ python -m srwpy.SRWLIB_ExampleViewDataFile -f ex10_res_int_prop_me.dat

reduced to

$ srw-viewer -f ex10_res_int_prop_me.dat

I added a step in the CI workflow to test the help for the script:

$ srw-viewer --help

Usage: srw-viewer [options]

Options:
  -h, --help            show this help message and exit
  -f FILE, --infile=FILE
                        input file name
  -e NUMBER, --e=NUMBER
                        photon energy
  -x NUMBER, --x=NUMBER
                        horizontal position
  -y NUMBER, --y=NUMBER
                        vertical position
  -l NUMBER, --readlab=NUMBER
                        read labels from the file header (1) or not (0)
  -j NUMBER, --joined=NUMBER
                        place different graphs jointly into one figure (1) or
                        into separate figures (0)
  -m, --multicol_data   visualize multicolumn data
  --m_colx=STR          column for horizontal axis
  --m_coly=STR          column for vertical axis
  -s SCALE, --scale=SCALE
                        scale to use in plots (linear, log, log2, log10)
  -w WIDTH, --width-pixels=WIDTH
                        desired width of pixels

I updated the version to 4.0.0b1 for the next beta release.

himanshugoel2797 commented 1 year ago

Looks good to me, but only Oleg has permissions to merge changes.

mrakitin commented 1 year ago

Thank you, @ochubar and @himanshugoel2797!