Re: [fluka-discuss]: Post processing USRBIN file (*.bnn format)

From: <me_at_marychin.org>
Date: Fri, 24 Oct 2014 11:29:25 -0700 (PDT)

Dear Rafiq,

I'm talking about your project file (bladeeblaa.flair), not Vasilis' system
files, not the files under directory ".flair".

You'll find:
- some lines of headers
- empty line
- section beginning with a pound sign (#), terminated by an empty line
- another section beginning with a pound sign (#), terminated by an empty line
- many more similar sections, including some starting with, "# USRBIN plot" --
each of these corresponds to a plot you see on the left panel under your FLAIR
plot tab.

Choose the section most convenient in terms of similarities and systematic
differences according to the many dat files you wish to generated. Cut out that
section and use it as your template. Make the string(s) you need to replace
unique i.e. if necessary change it to something unique eg. 'yahoo' instead of
'1', which probably occurs more than once even in places you do not intend to
replace. String-replace it with the parameter you wish to vary, eg
for ((...))
do
  sed .....
done >> bladeeblaa.flair
Just an example - there are of course dozens of different ways and scripting
language to accomplish this.
I think you'll need to reload bladeeblaa.flair under FLAIR.
Understandably it is a good practice to first secure a duplicate of the
original, eg bladeeblaa_orig.flair.

:) mary

> On 24 October 2014 at 06:39 Mohammad Islam <rafiqphy_at_gmail.com> wrote:
>
>
> Dear Mary,
> I found the flair templates which are basic input files as was stated
> in the manual. I could not figure out how to change the template and
> where to do that. For instance, if I have 5 bnn files and I want to
> generate dat files from each of them what I need to change ? Do you
> have any examples? Thank you very much.
>
> Rafiq
>
> On Thu, Oct 23, 2014 at 11:25 PM, me_at_marychin.org <me_at_marychin.org> wrote:
> > Just to add/clarify: hundreds of dat files can be generated with no more
> > than a few clicks from FLAIR > plot. .flair is ASCII. Just copy the relevant
> > part for one dat file, use this as template, replace (sed) the necessary
> > strings (eg. the fort unit and/or the detector name), loop through any
> > number of dat you wish, append (cat >>) into .flair. Reopen .flair, under
> > plot select all the plots, clicking 'Plot' once will generate all the dat
> > files. Even if it's over a hundred dat files per simulation.
> >
> > :) mary
> >
> > On 23 October 2014 at 20:06 "me_at_marychin.org" <me_at_marychin.org> wrote:
> >
> > Dear Rafiq,
> >
> > No no no, please don't use FLAIR 50 times to generate 50 dat files. After
> > the 50 runs complete, do FLAIR > Run > Data > Process. This will gather
> > together all the *_fort.?? files and based on these, produce one merged bnn.
> > Then go to plot, and plot this merge bnn. You will get a dat file which
> > contains the merged results of your 50 runs.
> >
> > :) mary
> >
> > On 23 October 2014 at 18:52 Mohammad Islam <rafiqul.islam_at_okstate.edu>
> > wrote:
> >
> > Dear mary,
> >
> > Thanks for your detail explanation. In my problem i run 50 input files
> > using flair simultaneously. I would love to take the .dat file that comes
> > from flair but in such case i have to use flair 50 times to generate 50 dat
> > file. Right? Thats why i thought to use the available bnn files. Do you
> > know any ways that will generate the dat files for all the bnn files at the
> > same time using identical flair setup? Thanks for all your help.
> >
> > Rafiq
> >
> > On Oct 23, 2014 7:19 PM, " me_at_marychin.org" < me_at_marychin.org> wrote:
> >
> > Dear Rafiq,
> >
> > USRBIN scoring is 3D in general (unless eg you ask for nbin=1 for one of the
> > dimensions). When we do a FLAIR plot for USRBIN it is typically 2D
> > (colormap). dat is the output from FLAIR plot, so it is also typically 2D,
> > unless you specifically ask for 1D projection (line plot). During FLAIR plot
> > for USRBIN, windowing / averaging takes place when we *select* the ranges
> > under 'Projection & Limits'. Note that this *select*ion takes place after
> > the simulation, as opposed to the specification in the USRBIN card before
> > the simulation. This windowing process makes dat a subset of bnn (tons of
> > data, as you say). bnn contains what you asked for in the USRBIN card. dat
> > contains what you ask for in FLAIR plot, and possibly some
> > re-normalisations.
> >
> > If you want a file similar to dat, why don't you just take dat itself, as I
> > mentioned earlier as one of the alternatives. Just make a duplicate of dat,
> > throw off the header lines, then, in the case of 1D, in MATLAB:
> > a = load('rafiqsfile.txt');
> > stairs(a(:,1),a(;,3))
> > --OR--
> > errorbar((a(:,1)+a(:,2))/2,a(:,3),a(:,3).*a(:,4)/100)
> > --OR--
> > plot((a(:,1)+a(:,2))/2,a(:,3))
> > --OR--
> > whatever you prefer.
> >
> > In the case of more dimensions, you'd need a loop to rearrange 'a' into a
> > matrix (in more general terms, 'array'). 2D matrix if 2D. 3D matrix if 3D.
> > If 2D:
> > imagesc(log10(b))
> > If 3D:
> > imagesc(log10(b(:,:,cut_rafiq_wants_to_see)))
> >
> > :) mary
> >
> >> On 23 October 2014 at 13:19 Mohammad Islam < rafiqphy_at_gmail.com> wrote:
> >>
> >>
> >> Dear Mary,
> >>
> >> Thank you very much for your prompt answer. As your suggestion, I
> >> converted using the approach => FLAIR>Run>Files>data then right-click
> >> on the bnn file and select 'To ascii'. But now I see a tons of data
> >> point (although most of them are zero), however if I plot the original
> >> bnn file using flair it gives me a simple *dat file of the whatever
> >> bin width that I had chosen in the input. Can you please tell me how
> >> can I interpret this ascii file. I want a similar .dat file that flair
> >> produces which is just a bragg curve in this case. Attached is one of
> >> the converted ascii file for your comments. Thank you very much.
> >>
> >> On Thu, Oct 23, 2014 at 2:51 PM, me_at_marychin.org < me_at_marychin.org> wrote:
> >> > Dear Rafiq,
> >> >
> >> > bnn is binary. If you'd like to do it the brute-force way, use MATLAB
> >> > fread.
> >> >
> >> > The easy way is to convert bnn to ascii, under FLAIR>Run>Files>data then
> >> > right-click on the bnn file and select 'To ascii'. Thereafter, use
> >> > MATLAB
> >> > fscanf, fgets, fgetl or ...
> >> >
> >> > An alternative to the 'To ascii' function would be just to take the dat
> >> > file, assuming you plotted with FLAIR.
> >> >
> >> > The lazyman's way is: manually edit the ascii file by removing the
> >> > header
> >> > lines. Thereafter, use MATLAB load. This way, you won't even need to
> >> > worry
> >> > about bytes and fields. You won't even need to open and close the file.
> >> >
> >> > MATLAB or PYTHON or PERL the algorithm would be similar (with the
> >> > exception
> >> > that MATLAB's load condenses all the steps in to one):
> >> > open the file
> >> > read each line, split according to the spaces or fields or bytes
> >> > arrange the numbers into an array
> >> > close the file
> >> >
> >> > :) mary
> >> >
> >> >> On 23 October 2014 at 11:32 Mohammad Islam < rafiqul.islam_at_okstate.edu>
> >> >> wrote:
> >> >>
> >> >>
> >> >> Dear Users,
> >> >>
> >> >> Does anybody know how to read the *.bnn file that comes from USRBIN
> >> >> using MATLAB or any other language. I tried to read it through MATLAB
> >> >> but it did not give me the data I was looking for. I need to do some
> >> >> post processing of the deposited energy which is in number of binary
> >> >> files. FLAIR can read and plot it and also save it as *.dat file but I
> >> >> have so many files that a little bit coding would be helpful. I
> >> >> appreciate any help.
> >> >>
> >> >> Thanks
> >> >> Rafiq
> >> >>
> >>
> >>
> >>
> >> --
> >> Mohammad Rafiqul Islam, PhD
> >
> >
> >
> >
> >
> >
>
>
>
> --
> Mohammad Rafiqul Islam, PhD
I think you'll need to reload bladeeblaa.flair under FLAIR.
Received on Fri Oct 24 2014 - 21:48:09 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 24 2014 - 21:48:10 CEST