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

Sybenzvi/enable ecsv #15

Merged
merged 8 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions BEMEWS_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
ID.stepcounterlimit = 1


# Test of output in ECSV format
ID.ecsvformat = True
ID.outputflag = True
ID.stepcounterlimit = 100


# do the calculation. The return is a four dimensional array of transition probabilities nu_alpha -> nu_i:
# index order is matter/antimatter, energy, i, alpha
Expand Down
27 changes: 14 additions & 13 deletions src/BEMEWS/_ext/BEMEWS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ PYBIND11_MODULE(_ext, m)
.def_readwrite("accuracy", &InputDataBEMEWS::accuracy)
.def_readwrite("stepcounterlimit", &InputDataBEMEWS::stepcounterlimit)
.def_readwrite("NE", &InputDataBEMEWS::NE)
.def_readwrite("ecsvformat", &InputDataBEMEWS::ecsvformat)
.def_readwrite("outputflag", &InputDataBEMEWS::outputflag)
;

Expand Down Expand Up @@ -162,7 +163,7 @@ vector<vector<vector<vector<double> > > > Run(InputDataBEMEWS ID)
ofstream fHvslambda; // a file for anything else
ofstream fSvsE;

if(ID.outputflag==true){ Initialize_Output(outputfilenamestem,fPvslambda,fHvslambda);}
if(ID.outputflag==true){ Initialize_Output(outputfilenamestem,fPvslambda,fHvslambda,ID);}

// *****************************************************
// *****************************************************
Expand Down Expand Up @@ -330,14 +331,14 @@ vector<vector<vector<vector<double> > > > Run(InputDataBEMEWS ID)
if(ID.outputflag==true){ output=true;}
if(output==true){
if(firsttime==true){
Output_Pvslambda(firsttime,lasttime,fPvslambda,lambdamin,Y,Scumulative);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambdamin,Y,Scumulative);
Output_Pvslambda(firsttime,lasttime,fPvslambda,lambdamin,Y,Scumulative,ID);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambdamin,Y,Scumulative,ID);
}

firsttime = false;

Output_Pvslambda(firsttime,lasttime,fPvslambda,lambdamin,Y,Scumulative);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambdamin,Y,Scumulative);
Output_Pvslambda(firsttime,lasttime,fPvslambda,lambdamin,Y,Scumulative,ID);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambdamin,Y,Scumulative,ID);

output = false;
}
Expand Down Expand Up @@ -454,9 +455,9 @@ vector<vector<vector<vector<double> > > > Run(InputDataBEMEWS ID)
if(output==true)
{ cout<<"\nOutput at\t"<<lambda<<flush;

Output_Pvslambda(firsttime,lasttime,fPvslambda,lambda,Y,Scumulative);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambda,Y,Scumulative);
//Output_PvsE(lasttime,fPvsE,outputfilenamestem,lambda,Y,Scumulative);
Output_Pvslambda(firsttime,lasttime,fPvslambda,lambda,Y,Scumulative,ID);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambda,Y,Scumulative,ID);
//Output_PvsE(lasttime,fPvsE,outputfilenamestem,lambda,Y,Scumulative,ID);

output=false;
}
Expand All @@ -477,14 +478,14 @@ vector<vector<vector<vector<double> > > > Run(InputDataBEMEWS ID)
else{ // output at the end of the code
if(ID.outputflag==true){ output = true;}
if(output==true){
Output_Pvslambda(firsttime,lasttime,fPvslambda,lambdamax,Y,Scumulative);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambdamax,Y,Scumulative);
Output_Pvslambda(firsttime,lasttime,fPvslambda,lambdamax,Y,Scumulative,ID);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambdamax,Y,Scumulative,ID);

lasttime = true;

Output_Pvslambda(firsttime,lasttime,fPvslambda,lambdamax,Y,Scumulative);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambdamax,Y,Scumulative);
Output_PvsE(lasttime,fPvsE,outputfilenamestem,lambdamax,Y,Scumulative);
Output_Pvslambda(firsttime,lasttime,fPvslambda,lambdamax,Y,Scumulative,ID);
Output_Hvslambda(firsttime,lasttime,fHvslambda,lambdamax,Y,Scumulative,ID);
Output_PvsE(lasttime,fPvsE,outputfilenamestem,lambdamax,Y,Scumulative,ID);

output = false;
}
Expand Down
1 change: 1 addition & 0 deletions src/BEMEWS/_ext/input_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct InputDataBEMEWS
double accuracy;
double stepcounterlimit; // how often it outputs data
bool outputflag; // whether the code outputs data as it does the integration
bool ecsvformat; // whether the output is in ECSV or tab-separated text files

InputDataBEMEWS(void) {;}
};
Expand Down
Loading