Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion on converters #358

Open
grzanka opened this issue Jun 6, 2020 · 3 comments
Open

Discussion on converters #358

grzanka opened this issue Jun 6, 2020 · 3 comments
Assignees

Comments

@grzanka
Copy link
Contributor

grzanka commented Jun 6, 2020

Right now following converters are available:

positional arguments:
  converter
    txt          converts to plain txt file
    image        converts to PNG images
    excel        converts to MS Excel file
    hdf          converts to HDF file
    plotdata     converts to gnuplot data
    gnuplot      converts to gnuplot script
    inspect      prints metadata
    sparse       converts to sparse matrix format
    tripcube     converts to trip98 data cube
    tripddd      converts to trip98 ddd file

I would like to discuss naming and funcionality of some of them. The oldest one, namely txt is an equivalent of the old bdo2txt converter and is producing exactly the same output (using Fortran-like formatting), i.e:

#   DETECTOR OUTPUT MSH/DMSH
#   X BIN:     1 Y BIN:   100 Z BIN:     1
#   JPART:    -1 DETECTOR TYPE: ENERGY    
#   X START:-0.100D+01 Y START:-0.500D+01 Z START: 0.100D+02
#   X END  : 0.100D+01 Y END  : 0.500D+01 Z END  : 0.120D+02
#   PRIMARIES: 0.300D+04
 0.0000000E+00 -0.4950000E+01  0.1100000E+02  0.7468303173602919E-02
 0.0000000E+00 -0.4850000E+01  0.1100000E+02  0.8106817623222365E-02
 0.0000000E+00 -0.4750000E+01  0.1100000E+02  0.8401210886999192E-02
 0.0000000E+00 -0.4650000E+01  0.1100000E+02  0.8509474193308351E-02
 0.0000000E+00 -0.4550000E+01  0.1100000E+02  0.9730082428327397E-02
 0.0000000E+00 -0.4450000E+01  0.1100000E+02  0.1184107508916652E-01
 0.0000000E+00 -0.4350000E+01  0.1100000E+02  0.1170395899225091E-01
 0.0000000E+00 -0.4250000E+01  0.1100000E+02  0.9939687263975738E-02
 0.0000000E+00 -0.4150000E+01  0.1100000E+02  0.9605372797199595E-02
 0.0000000E+00 -0.4050000E+01  0.1100000E+02  0.1378746695705103E-01

Another useful converter is plotdata which for the same output is producing following output:

-4.95 0.0074683
-4.85 0.00810682
-4.75 0.00840121
-4.65 0.00850947
-4.55 0.00973008
-4.45 0.0118411
-4.35 0.011704
-4.25 0.00993969
-4.15 0.00960537
-4.05 0.0137875
(...)

To summarize:

  • txt is always generating 5 columns (Fortran-style, fixed-with): X,Y,Z + data + error.
  • plotdata is generating only columns for which number of bins is > 1. Errors (i.e. stderr from merging of multiple binary files) are included only in case they have been calculated.

What I have in mind is to:

  • merge both plotdata and txt converter into single one, called i.e. txt
  • drop Fortran-style printing in txt converter and make it an option (like --number-style with possible values: variable or fixed or specifing number of digits to be printed)
  • skipping columns/axis with single bins is going to be an option (by default set to True), called i.e. --include-constant-axis
  • add reasonable header with information about binning, detector type, units, etc. I'd use some of existing format like YAML to ensure human- and computer-readability.

@nbassler Do you have some ideas ?

@nbassler
Copy link
Member

nbassler commented Jun 6, 2020

Yes, I had similar thoughts.

  • I agree that the fortran writer is obsolete, and it can be removed
  • It makes sense to move plotdataas the txt group. But any header information should still be prefixed with #, this is widely understood, e.g. by numpy and xmgrace.
  • txt, text and dat could be used synonymously.
  • --number-style and --include-constant-axis is OK but not very important, imho.

What I find really important, however is,:

  • -nx=int, -ny=int or -nz=int to be able to extract a single slice from a 3D cube.
  • -x=float, -y=float or -z=float to be able to extract a single slice from a 3D cube at that position.
    if out of bounds, throw error, also saying the available range.

What would be nice:

@nbassler
Copy link
Member

One more note:
DDD converter needs --projectile and --energy
However, I think both are available from the .bdo file. Would be very nice to get rid of these in pymchelper.
Related: pytrip/TRiPbase#13

@nbassler
Copy link
Member

One more note:
DDD converter needs --projectile and --energy
However, I think both are available from the .bdo file. Would be very nice to get rid of these in pymchelper.
Related: pytrip/TRiPbase#13

Issue #366

@grzanka grzanka self-assigned this Dec 12, 2024
@grzanka grzanka pinned this issue Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants