Plotting USRBIN results with external software

Thanks for your reply Sir.
I managed to plot the .bnn file.
I have an another question now related to plotting .bnn file in Matlab. More specifically, I want to plot the curve GeV/cm3/particle vs Z coordinate.
The procedure is:

  1. take the ASCII file of .bnn file from Flair and plot the column of interest, but I am not aware of the meaning of the different column.

    or
  2. take the .dat file for 1D prjection and plot the third column which is the bin content.
    dat
    Which should be the more correct procedure?
    Thanks
    Lovepreet
1 Like

Hi Lovepreet,
The .bnn files are binary formatted data files associated to USRBINs. These can be plotted in the Plot tab of Flair by clicking Add → USRBIN and then browsing for the .bnn file you want under Binning detector. After selecting the file, the binning info will then automatically display the USRBIN definition as you included it in your input file. Is this what you mean by recovering the input?

The .bnn files can be converted to readable ascii text files by using the → ASCII button on the Run/Files tab as shown in this answer. It is then a simple matter of only selecting the data columns you want to plot (i.e. getting rid of the header text block) in MATLAB or any other language.

Best regards,

Andreas

Thanks Sir.
Above, you can fine the .bnn file screenshot in ASCII format. I wanted to know the meaning of the different columns and if for plotting it is useful to use .dat file or .bnn file.
Best wishes,
Lovepreet

Hi Lovepreet,
In your first case the 3D Cartesian USRBIN data is written as a 1D sequence of total length NXNYNZ with NX, NY and NZ the amount of bins along each coordinate. Each value in the data file corresponds to a unique combination in the Cartesian binning mesh. The values are stated by iterating over the x index first, then the y index, then the z index. This means that the entries are written in sequence as A(1, 1, 1), A(2, 1, 1), A(3, 1, 1), … A(NX, 1, 1), A(1, 2, 1), A(2, 2, 1), A(3, 2, 1), … A(NX, NY, NZ). The fact that the data file is structured using 10 columns has no meaning, it is fully arbitrary. This means that the last entry on row 1 is A(10, 1, 1) and the first entry on row 2 is A(11, 1, 1) in this case. Reading in the values this way will allow you to manipulate the data however you want, in MATLAB or any other language. (Note that below a second matrix of the same size shows the respective statistical errors)

In the second case you plotted with Flair which indeed produces a .dat file as result, indicating the projected values along the Z-axis: columns indicate the lower Z-bin boundary, the upper Z-bin boundary, the value and the relative error (in %). The available plotting utilities in Flair for USRBIN data hence don’t require you to read in the matrix data in sequence, this is done automatically. Hence it is entirely your own preference how to plot the values since the data comes from the same file anyway.

Cheers,

Andreas

1 Like

Thanks for your reply, Sir.
I understood the second case.
For the first case, I didn’t understand well. On the first row there is the variation of amount of bins along x, on the second row there is the variation of bins along y, on the third row there is the variation of bins along z and so on. or this is not the case?
Thanks
Lovepreet

Hi Lovepreet, sorry if my explanation was not clear. I rephrased my explanation in the previous answer above, hopefully this provides a better explanation of what the different data file values correspond to for the first case.

Cheers,

Andreas

Thank you Sir. Now I got my answer.
Just to be sure in my case NX = 320, NY=1 and NZ=320 , right?
Best regards,
Lovepreet

That is correct, as also shown in the header of the ASCII .bnn file.

Cheers,

Andreas

Thank you Sir.
Best wishes
Lovepreet