Class Documentation¶
bamr_class¶
-
class
bamr_class
¶ Compute neutron star structure for each MCMC point.
There will be a number of instances of this class equal to the number of OpenMP threads, all of which share the same neutron star data (in nsd) and settings (in set). They will each have their own model object, stored in mod, which is set in mcmc_bamr::set_model() .
Public Functions
-
bamr_class
()¶
-
virtual
~bamr_class
()¶
-
virtual int
compute_point
(const ubvector &pars, std::ofstream &scr_out, double &weight, model_data &dat)¶ Compute the EOS corresponding to parameters in
e
and put output intab_eos
.
-
virtual int
fill
(const ubvector &pars, double weight, std::vector<double> &line, model_data &dat)¶ Fill vector in
line
with data from the current Monte Carlo point.
-
mcmc_bamr¶
-
class
mcmc_bamr
: public o2scl::mcmc_para_cli<point_funct, fill_funct, model_data, ubvector>¶ Statistical analysis of EOS from M and R constraints.
Main functions called from the command-line interface
-
virtual int
set_model
(std::vector<std::string> &sv, bool itive_com)¶ Set the model for the EOS to use.
Public Functions
-
virtual
~mcmc_bamr
()¶
-
virtual void
setup_cli
()¶ Set up the ‘cli’ object.
This function adds three commands (mcmc, model, add-data) and the ‘set’ parameters.
Public Members
-
o2scl::cli
cl
¶ The command-line interface object.
Protected Functions
-
virtual void
file_header
(o2scl_hdf::hdf_file &hf)¶ Write initial data to HDF file.
-
virtual int
mcmc_init
()¶ Make any necessary preparations for the mcmc() function.
This is called by mcmc(). If the return value is non-zero then it is assumed that the calculation fails and mcmc() returns.
-
virtual int
add_data
(std::vector<std::string> &sv, bool itive_com)¶ Add a data distribution to the list.
-
virtual int
add_data_alt
(std::vector<std::string> &sv, bool itive_com)¶ Add a data distribution to the list.
-
virtual int
mcmc_func
(std::vector<std::string> &sv, bool itive_com)¶ Perform the MCMC simulation.
-
virtual int
threads
(std::vector<std::string> &sv, bool itive_com)¶ Set the number of OpenMP threads.
-
virtual int
initial_point_last
(std::vector<std::string> &sv, bool itive_com)¶ Use the last point in a specifed file for the initial point.
-
virtual int
initial_point_best
(std::vector<std::string> &sv, bool itive_com)¶ Use the highest likelihood point in the specified file for the initial point.
-
virtual int
read_prev_results
(std::vector<std::string> &sv, bool itive_com)¶ Read previous results from a file.
Protected Attributes
-
std::string
model_type
¶ A string indicating which model is used, set in set_model().
-
std::vector<bamr_class *>
bc_arr
¶ Vector of bamr_class objects (one for each OpenMP thread)
This is currently a pointer because it makes it a lot easier to replace these pointers with children. A shared_ptr might be better, but I’ve had problems implementing vector<shared_ptr> correctly.
-
std::shared_ptr<settings>
set
¶ The bamr::settings object (shared by instances of bamr_class)
-
std::shared_ptr<ns_data>
nsd
¶ The bamr::ns_data object (shared by instances of bamr_class)
-
virtual int
model_data¶
-
class
model_data
¶ Data at each MC point.
Public Functions
-
model_data
()¶
-
model_data
(const model_data &md)¶ Copy constructor.
-
model_data &
operator=
(const model_data &md)¶ Make operator= copy constructor private.
-
settings¶
-
class
settings
¶ Settings object.
Parameter objects for the ‘set’ command
-
o2scl::cli::parameter_double
p_min_max_mass
¶
-
o2scl::cli::parameter_double
p_exit_mass
¶
-
o2scl::cli::parameter_double
p_input_dist_thresh
¶
-
o2scl::cli::parameter_double
p_min_mass
¶
-
o2scl::cli::parameter_int
p_grid_size
¶
-
o2scl::cli::parameter_int
p_mass_switch
¶
-
o2scl::cli::parameter_int
p_verbose
¶
-
o2scl::cli::parameter_bool
p_debug_star
¶
-
o2scl::cli::parameter_bool
p_debug_load
¶
-
o2scl::cli::parameter_bool
p_debug_eos
¶
-
o2scl::cli::parameter_bool
p_baryon_density
¶
-
o2scl::cli::parameter_bool
p_use_crust
¶
-
o2scl::cli::parameter_bool
p_inc_baryon_mass
¶
-
o2scl::cli::parameter_bool
p_norm_max
¶
-
o2scl::cli::parameter_bool
p_compute_cthick
¶
-
o2scl::cli::parameter_bool
p_addl_quants
¶
-
o2scl::cli::parameter_bool
p_crust_from_L
¶
-
o2scl::cli::parameter_bool
p_mpi_load_debug
¶
-
o2scl::cli::parameter_double
p_nb_low
¶
-
o2scl::cli::parameter_double
p_nb_high
¶
-
o2scl::cli::parameter_double
p_e_low
¶
-
o2scl::cli::parameter_double
p_e_high
¶
-
o2scl::cli::parameter_double
p_m_low
¶
-
o2scl::cli::parameter_double
p_m_high
¶
-
o2scl::cli::parameter_double
p_mvsr_pr_inc
¶
Limits on mass and radius from source data files
These are automatically computed in load_mc() as the smallest rectangle in the \( (M,R) \) plane which encloses all of the user-specified source data
-
double
in_m_min
¶
-
double
in_m_max
¶
-
double
in_r_min
¶
-
double
in_r_max
¶
Other parameters accessed by ‘set’ and ‘get’
-
int
grid_size
¶ Number of bins for all histograms (default 100)
-
double
mvsr_pr_inc
¶ Pressure increment for the M vs. R curve (default 1.1)
-
bool
norm_max
¶ If true, normalize the data distributions so that the max is one, otherwise, normalize so that the integral is one (default false)
-
bool
use_crust
¶ If true, use the default crust (default true)
-
bool
debug_load
¶ If true, output debug information about the input data files (default false)
-
bool
debug_star
¶ If true, output stellar properties for debugging (default false)
-
bool
debug_eos
¶ If true, output equation of state for debugging (default false)
-
bool
baryon_density
¶ If true, compute the baryon density (default true)
-
double
input_dist_thresh
¶ The lower threshold for the input distributions (default 0.0)
-
double
exit_mass
¶ The upper mass threshold (default 10.0)
-
bool
mpi_load_debug
¶ If true, debug MPI file loading.
-
double
min_mass
¶ Minimum mass allowed for any of the individual neutron stars (default 1.0)
-
double
min_max_mass
¶ Minimum allowed maximum mass (default 2.0)
-
bool
best_detail
¶ If true, output more detailed information about the best point (default false)
-
bool
inc_baryon_mass
¶ If true, output information about the baryon mass as well as the gravitational mass (default false)
-
bool
compute_cthick
¶ If true, compute crust thicknesses (default false)
-
bool
addl_quants
¶ If true (default false)
-
bool
crust_from_L
¶ If true, compute a crust consistent with current value of L.
Only works if use_crust, baryon_density, and compute_cthick are true and the model provides S and L.
-
int
mass_switch
¶
Histogram limits
-
double
nb_low
¶
-
double
nb_high
¶
-
double
e_low
¶
-
double
e_high
¶
-
double
m_low
¶
-
double
m_high
¶
Public Functions
-
settings
()¶
-
void
setup_cli
(o2scl::cli &cl)¶ Add parameters to the o2scl::cli object.
Public Members
-
int
verbose
¶ Verbosity parameter.
-
o2scl::cli::parameter_double
ns_data¶
-
class
ns_data
¶ Neutron star data object.
This class is designed so that multiple OpenMP threads can use the same const instance of this class (i.e. so long as they do not change the member data).
Input neutron star data
-
std::vector<o2scl::table3d>
source_tables
¶ Input probability distributions.
-
std::vector<o2scl::table3d>
source_tables_alt
¶ Alternate input probability distributions.
-
std::vector<std::string>
source_names
¶ The names for each source.
-
std::vector<std::string>
table_names
¶ The names of the table in the data file.
-
std::vector<std::string>
source_fnames
¶ File names for each source.
-
std::vector<std::string>
source_fnames_alt
¶ Alternate file names for each source.
-
std::vector<std::string>
slice_names
¶ Slice names for each source.
-
std::vector<double>
init_mass_fracs
¶ The initial set of neutron star masses.
-
size_t
n_sources
¶ The number of sources.
-
virtual int
add_data
(std::vector<std::string> &sv, bool itive_com)¶ Add a data distribution to the list.
-
virtual int
add_data_alt
(std::vector<std::string> &sv, bool itive_com)¶ Add a data distribution to the list.
Load input probability distributions.
Ensure all MPI ranks read all files while ensuring that no two ranks simultaneously read the same file.
Let MPI_Size be denoted n. If n is 1, no messages are sent and the single rank always reads the files in order. When n is larger than 1, rank 0 still reads the files in order. Rank n-1 begins by reading the second file, rank n-2 begins by reading the third file, and so on, until there are no more ranks left which are not reading files or there are no more files left. After reading, all ranks which read files send a message to the next rank (in sequence) prompting them to proceed with the next file. Once each rank has read all of the files, it does not send or receive any further messages (the number of messages sent for n>1 is n times the number of files times). If settings::mpi_load_debug is set to 1, then the various MPI messages are copied to scr_out, no files are actually read, and exit() is called after all messages have been sent and received by all ranks.
Public Functions
-
ns_data
()¶
-
std::vector<o2scl::table3d>
nstar_cold2¶
-
class
nstar_cold2
: public o2scl::nstar_cold¶ A simplified version of nstar_cold.
This simplified version only computes the energy density and pressure rather than the version which computes several extra quantities. This class is part of bamr::model.
Public Functions
-
int
calc_eos
(double np_0 = 0.0)¶ Compute the core EOS.
-
int
process¶
-
class
process
¶ Process MCMC data from
bamr
Command-line parameter objects
-
o2scl::cli::parameter_double
p_xscale
¶
-
o2scl::cli::parameter_double
p_yscale
¶
-
o2scl::cli::parameter_bool
p_errors
¶
-
o2scl::cli::parameter_bool
p_logx
¶
-
o2scl::cli::parameter_bool
p_logy
¶
-
o2scl::cli::parameter_bool
p_logz
¶
-
o2scl::cli::parameter_int
p_hist_size
¶
-
o2scl::cli::parameter_int
p_n_blocks
¶
-
o2scl::cli::parameter_int
p_line_start
¶
-
o2scl::cli::parameter_int
p_verbose
¶
-
o2scl::cli::parameter_string
p_constraint
¶
-
o2scl::cli::parameter_string
p_weights
¶
Command-line parameters
-
int
verbose
¶ Verbosity (default 1)
-
int
line_start
¶ Ignore all lines before start.
-
double
xscale
¶ Scale for x-axis.
-
double
yscale
¶ Scale for y-axis.
-
bool
logx
¶ If true, use a logarithmic x scale.
-
bool
logy
¶ If true, use a logarithmic y scale.
-
bool
logz
¶ If true, use a logarithmic z scale.
-
bool
errors
¶ If true, plot errors in 1d.
-
int
hist_size_int
¶ Histogram size.
-
int
n_blocks
¶ Number of blocks.
-
std::string
weights_col
¶ Column representing weights.
Axis limit variables
-
bool
xset
¶ If true, x limits are set.
-
double
user_xlow
¶ Lower x value.
-
double
user_xhigh
¶ Upper x value.
-
bool
yset
¶ If true, y limits are set.
-
double
user_ylow
¶ Lower y value.
-
double
user_yhigh
¶ Upper y value.
Const confidence limits
-
const double
one_sigma
¶ The one-sigma limit of a normal distribution, 0.6827.
-
const double
two_sigma
¶ The two-sigma limit of a normal distribution, 0.9545.
-
const double
three_sigma
¶ The three-sigma limit of a normal distribution, 0.9973.
Other class member data
-
std::string
constraint
¶ Constraint to apply to the data.
-
o2scl::format_float
ff
¶ Formatter for floating point numbers.
By default, this is set in the constructor to
ff.latex_mode(); ff.set_sig_figs(4); ff.set_pad_zeros(true); ff.set_exp_limits(-5,5);
-
ubvector
scale
¶ Scaling for each element in Bayes factor distance metric.
-
std::vector<std::vector<double>>
bfactor_data
¶ Storage for Bayes factor computation.
Commands
-
int
auto_corr
(std::vector<std::string> &sv, bool itive_com)¶ Create a table of autocorrelation data from a specified column.
-
int
xlimits
(std::vector<std::string> &sv, bool itive_com)¶ Set limits for the x-axis.
-
int
ylimits
(std::vector<std::string> &sv, bool itive_com)¶ Set limits for the y-axis.
-
int
hist
(std::vector<std::string> &sv, bool itive_com)¶ Create a histogram from a specified column.
-
int
hist2
(std::vector<std::string> &sv, bool itive_com)¶ Create a two-dimensional histogram from two user-specified columns.
-
int
hist_set
(std::vector<std::string> &sv, bool itive_com)¶ Create a set of histograms from a set of columns in the bamr MCMC output.
-
int
curve_set
(std::vector<std::string> &sv, bool itive_com)¶ Desc.
-
int
combine
(std::vector<std::string> &sv, bool itive_com)¶ Combine several
bamr
output files.
-
int
contours
(std::vector<std::string> &sv, bool itive_com)¶ Specify which contour levels to use.
-
int
mass_sel
(std::vector<std::string> &sv, bool itive_com)¶ Create new columns at a selected mass.
Internal functions
-
void
swap
(double &w1, size_t &i1, ubvector &x1, double &w2, size_t &i2, ubvector &x2)¶ Swap w1 and w2, i1 and i2, and x1 and x2 (for bfactor())
-
double
func
(size_t n, const ubvector &x)¶ Function to integrate for Bayes factor.
Public Functions
-
process
()¶ Create the process object.
-
void
run
(int argc, char *argv[])¶ Main public interface.
-
o2scl::cli::parameter_double