31 #include <o2scl/rng_gsl.h>
32 #include <o2scl/shared_ptr.h>
33 #include <o2scl/uniform_grid.h>
34 #include <o2scl/table3d.h>
35 #include <o2scl/hdf_file.h>
36 #include <o2scl/exception.h>
39 #include <o2scl/cli_readline.h>
41 #include <o2scl/cli.h>
274 int first_point_type;
275 static const int fp_unspecified=-1;
276 static const int fp_last=-2;
277 static const int fp_best=-3;
347 virtual int set_model(std::vector<std::string> &sv,
bool itive_com);
351 virtual int set_first_point(std::vector<std::string> &sv,
bool itive_com);
355 virtual int add_data(std::vector<std::string> &sv,
bool itive_com);
367 virtual int mcmc(std::vector<std::string> &sv,
bool itive_com);
390 virtual bool make_step(
double w_current,
double w_next,
bool debug,
391 bool warm_up,
int iteration);
412 double weight,
bool new_meas,
size_t n_meas,
ubvector &weights);
420 double weight,
bool new_meas,
size_t n_meas,
ubvector &weights,
421 std::vector<double> &line);
465 (std::string fname_prefix,
entry &e_best,
double w_best,
500 virtual void run(
int argc,
char *argv[]);
504 std::vector<int> ret_codes;
505 static const int ix_success=0;
506 static const int ix_mr_outside=1;
507 static const int ix_r_outside=2;
508 static const int ix_zero_wgt=3;
509 static const int ix_press_dec=4;
510 static const int ix_nb_problem=5;
511 static const int ix_nb_problem2=6;
512 static const int ix_crust_unstable=7;
513 static const int ix_mvsr_failed=8;
514 static const int ix_tov_failure=9;
515 static const int ix_small_max=10;
516 static const int ix_tov_conv=11;
517 static const int ix_mvsr_table=12;
518 static const int ix_acausal=13;
519 static const int ix_acausal_mr=14;
520 static const int ix_param_mismatch=15;
521 static const int ix_neg_pressure=16;
522 static const int ix_no_eos_table=17;
523 static const int ix_eos_solve_failed=18;
model * modp2
The second copy of the model for the EOS.
bool output_next
If true, output next point.
bool inc_baryon_mass
If true, output information about the baryon mass as well as the gravitational mass.
bool first_file_update
If true, then first_update() has been called.
Definition of EOS models.
virtual double compute_weight(entry &e, model &modref, o2scl::tov_solve *ts, int &success, ubvector &wgts, bool warm_up)
Compute from parameters in entry e.
bool debug_star
If true, output stellar properties for debugging.
virtual void run(int argc, char *argv[])
Main wrapper for parsing command-line arguments.
A data class which holds the EOS parameters, the masses and the radii.
bool debug_eos
If true, output equation of state for debugging.
virtual void select_mass(entry &e_current, entry &e_next, double mmax)
The function which selects the next neutron star masses.
std::vector< o2scl::table3d > source_tables
Input probability distributions.
int mpi_nprocs
The MPI number of processors.
bool baryon_density
If true, compute the baryon density.
o2scl::tov_solve def_ts2
Second default TOV solver.
o2scl::tov_solve def_ts
Default TOV solver.
model * modp
The model for the EOS.
int file_update_iters
The number of MCMC successes between file updates.
Base class for an EOS parameterization.
int grid_size
Number of bins for all histograms (default 100)
bool use_crust
If true, use the default crust (default true)
double schwarz_km
Schwarzchild radius (set in constructor)
size_t nparams
Number of parameters, set in set_model()
std::string first_point_file
The file containing the initial point.
virtual void load_mc()
Load input probability distributions (called by mcmc())
std::vector< std::string > run_args
The arguments sent to the command-line.
virtual void add_measurement(entry &e, o2scl::o2_shared_ptr< o2scl::table_units<> >::type tab_eos, o2scl::o2_shared_ptr< o2scl::table_units<> >::type tab_mvsr, double weight, bool new_meas, size_t n_meas, ubvector &weights)
Add a measurement.
virtual int mcmc_init()
Make any necessary preparations for the mcmc() function.
o2scl::table_units tc
Main data table for Markov chain.
virtual int set_first_point(std::vector< std::string > &sv, bool itive_com)
Set the first point in the parameter space.
bool has_eos
True if the model has an EOS.
int user_seed
If non-zero, use as the seed for the random number generator.
Definition of entry class.
virtual void fill_line(entry &e, o2scl::o2_shared_ptr< o2scl::table_units<> >::type tab_eos, o2scl::o2_shared_ptr< o2scl::table_units<> >::type tab_mvsr, double weight, bool new_meas, size_t n_meas, ubvector &weights, std::vector< double > &line)
Fill vector in line with data from the current Monte Carlo point.
double input_dist_thresh
The lower threshold for the input distributions.
double min_max_mass
Minimum allowed maximum mass.
virtual void setup_cli()
Set up the 'cli' object.
virtual void update_files(std::string fname_prefix, model &modp, entry &e_current)
Write histogram data to files with prefix fname.
std::vector< std::string > table_names
The names of the table in the data file.
double mpi_start_time
The MPI starting time.
o2scl::err_hnd_cpp ee
Error handler for each thread.
double min_mass
Minimum mass allowed for any of the individual neutron stars.
virtual void compute_star(entry &e, model &modref, o2scl::tov_solve *ts, int &success)
Tabulate EOS and then use in cold_nstar.
size_t nsources
The number of sources.
bool best_detail
If true, output more detailed information about the best point.
Definition of nstar_cold2.
o2scl::rng_gsl gr
Random number generator.
virtual int add_data(std::vector< std::string > &sv, bool itive_com)
Add a data distribution to the list.
virtual bool make_step(double w_current, double w_next, bool debug, bool warm_up, int iteration)
Decide to accept or reject the step.
size_t n_chains
Number of Markov chain segments.
virtual void prepare_eos(entry &e, model &modref, o2scl::tov_solve *tsr, int &success)
Further preparations of the EOS before calling the TOV solver.
int n_warm_up
Number of warm up steps (successful steps not iterations)
std::vector< std::string > slice_names
Slice names for each source.
std::ofstream scr_out
The screen output file.
double exit_mass
An upper mass threshold.
virtual void init_grids_table(entry &low, entry &high)
Initialize the expectation value objects.
o2scl::tov_solve * ts2
Second pointer to a TOV solver.
double step_fac
MCMC stepsize factor (default 15)
virtual int set_model(std::vector< std::string > &sv, bool itive_com)
Set the model for the EOS to use.
bool has_esym
True if the model provides S and L.
size_t mh_success
The number of Metropolis steps which succeeded.
virtual int mcmc(std::vector< std::string > &sv, bool itive_com)
Run a MCMC simulation.
ubvector first_point
The first point in the parameter space.
std::vector< double > markov_chain
Store the full Markov chain.
double max_time
Time in seconds (3600 seconds is one hour, default is 86400 seconds or 1 day)
bool norm_max
If true, normalize the data distributions so that the max is one, otherwise, normalize so that the in...
o2scl::tov_solve * ts
Pointer to a TOV solver.
virtual void output_best(std::string fname_prefix, entry &e_best, double w_best, o2scl::o2_shared_ptr< o2scl::table_units<> >::type tab_eos, o2scl::o2_shared_ptr< o2scl::table_units<> >::type tab_mvsr, ubvector &wgts)
Output the "best" EOS obtained so far (called by mcmc())
size_t mcmc_iterations
Total number of mcmc iterations.
o2scl::eos_tov_interp teos
EOS interpolation object for TOV solver.
virtual void first_update(o2scl_hdf::hdf_file &hf, model &modp)
Write initial data to HDF file.
bool debug_load
If true, output debug information about the input data files (default false)
virtual void table_names_units(std::string &s, std::string &u)
Setup column names and units for data table.
std::vector< std::string > source_names
The names for each source.
std::vector< double > first_mass
The initial set of neutron star masses.
Statistical analysis of EOS from M and R constraints.
size_t mh_failure
The number of Metropolis steps which failed.
o2scl::cli cl
Command-line interface.
std::string model_type
A string indicating which model is used, set in set_model().
int mpi_rank
The MPI processor rank.
std::vector< std::string > source_fnames
File names for each source.
size_t chain_size
Number of chains.
int max_iters
Maximum number of iterations (default 0)