Skip to content

Commit

Permalink
Merge pull request #43 from temken/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
temken authored Mar 27, 2023
2 parents 658c42a + 314319e commit e6a47a5
Show file tree
Hide file tree
Showing 59 changed files with 8,971 additions and 4,562 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.11)

project(obscura VERSION "1.0.2")
project(obscura VERSION "1.0.3")

# Use C++-11
set(CMAKE_CXX_STANDARD 11)
Expand Down Expand Up @@ -30,7 +30,7 @@ include(FetchContent)
set(LIBPHYSICA_DIR ${EXTERNAL_DIR}/libphysica)
FetchContent_Declare(libphysica
GIT_REPOSITORY https://github.com/temken/libphysica.git
GIT_TAG origin/dev
GIT_TAG v0.1.5
SOURCE_DIR "${LIBPHYSICA_DIR}"
CMAKE_ARGS "-DCMAKE_BUILD_TYPE=Release -DCODE_COVERAGE=OFF")
FetchContent_GetProperties(libphysica)
Expand All @@ -53,7 +53,7 @@ endif()
set(GTEST_DIR ${EXTERNAL_DIR}/googletest)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
GIT_TAG release-1.12.1
SOURCE_DIR "${GTEST_DIR}/src"
BINARY_DIR "${GTEST_DIR}/build"
CONFIGURE_COMMAND ""
Expand Down
300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_1s_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_1s_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_1s_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_1s_4.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_2p_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_2p_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_2p_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_2p_4.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_2s_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_2s_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_2s_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_2s_4.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3d_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3d_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3d_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3d_4.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3p_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3p_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3p_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3p_4.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3s_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3s_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3s_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_3s_4.txt

Large diffs are not rendered by default.

302 changes: 201 additions & 101 deletions data/Atomic_Response_Functions/Xe_4d_1.txt

Large diffs are not rendered by default.

302 changes: 201 additions & 101 deletions data/Atomic_Response_Functions/Xe_4d_2.txt

Large diffs are not rendered by default.

302 changes: 201 additions & 101 deletions data/Atomic_Response_Functions/Xe_4d_3.txt

Large diffs are not rendered by default.

302 changes: 201 additions & 101 deletions data/Atomic_Response_Functions/Xe_4d_4.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_4p_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_4p_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_4p_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_4p_4.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_4s_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_4s_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_4s_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_4s_4.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_5p_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_5p_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_5p_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_5p_4.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_5s_1.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_5s_2.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_5s_3.txt

Large diffs are not rendered by default.

300 changes: 200 additions & 100 deletions data/Atomic_Response_Functions/Xe_5s_4.txt

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions include/obscura/DM_Distribution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ class DM_Distribution
void Print_Summary_Base();

public:
double DM_density; //Local DM density
double DM_density; // Local DM density
bool DD_use_eta_function;

//Constructors:
// Constructors:
DM_Distribution();
DM_Distribution(std::string label, double rhoDM, double vMin, double vMax);

double Minimum_DM_Speed() const;
double Maximum_DM_Speed() const;

//Distribution functions
// Distribution functions
virtual double PDF_Velocity(libphysica::Vector vel) { return 0.0; };
virtual double PDF_Speed(double v);
virtual double CDF_Speed(double v);
Expand All @@ -39,11 +39,11 @@ class DM_Distribution
virtual double Differential_DM_Flux(double v, double mDM);
virtual double Total_DM_Flux(double mDM);

//Averages
// Averages
virtual libphysica::Vector Average_Velocity();
virtual double Average_Speed(double vMin = -1.0);

//Eta-function for direct detection
// Eta-function for direct detection
virtual double Eta_Function(double vMin);

virtual void Print_Summary(int mpi_rank = 0);
Expand All @@ -65,6 +65,7 @@ class Imported_DM_Distribution : public DM_Distribution

public:
Imported_DM_Distribution(double rho, const std::string& filepath);
Imported_DM_Distribution(std::vector<std::vector<double>>& pdf_table, double rho = 1.0);

virtual double PDF_Speed(double v) override;

Expand Down
2 changes: 1 addition & 1 deletion include/version.hpp.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef VERSION_HPP
#define VERSION_HPP

#define OBSCURA_LOGO " _ \n | | \n ___ | |__ ___ ___ _ _ _ __ __ _ \n / _ \\| '_ \\/ __|/ __| | | | '__/ _` |\n| (_) | |_) \\__ \\ (__| |_| | | | (_| |\n \\___/|_.__/|___/\\___|\\__,_|_| \\__,_|\n developed by " AUTHOR " (" YEAR ")\n"
#define OBSCURA_LOGO " _ \n | | \n ___ | |__ ___ ___ _ _ _ __ __ _ \n / _ \\| '_ \\/ __|/ __| | | | '__/ _` |\n| (_) | |_) \\__ \\ (__| |_| | | | (_| |\n \\___/|_.__/|___/\\___|\\__,_|_| \\__,_|\n by " AUTHOR " (" YEAR ")\n"
#define SEPARATOR "\n##############################################################\n"

#define AUTHOR "Timon Emken"
Expand Down
50 changes: 25 additions & 25 deletions src/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void Configuration::Initialize_Result_Folder(int MPI_rank)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in obscura::Configuration::Initialize_Result_Folder(): No 'ID' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in obscura::Configuration::Initialize_Result_Folder(): No 'ID' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
results_path = TOP_LEVEL_DIR "results/" + ID + "/";
Expand Down Expand Up @@ -137,12 +137,12 @@ void Configuration::Read_Config_File()
}
catch(const FileIOException& fioex)
{
std::cerr << "Error in obscura::Configuration::Read_Config_File(): I/O error while reading configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in obscura::Configuration::Read_Config_File(): I/O error while reading configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
catch(const ParseException& pex)
{
std::cerr << "Error in obscura::Configuration::Read_Config_File(): Configurate file parse error at " << pex.getFile() << ":" << pex.getLine() << " - " << pex.getError() << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in obscura::Configuration::Read_Config_File(): Configurate file parse error at " << pex.getFile() << ":" << pex.getLine() << " - " << pex.getError() << std::endl;
std::exit(EXIT_FAILURE);
}
}
Expand Down Expand Up @@ -207,7 +207,7 @@ void Configuration::Construct_DM_Particle()
Configuration::Construct_DM_Particle_Standard(DM_interaction);
else
{
std::cerr << "Error in obscura::Configuration::Construct_DM_Particle(): 'DM_interaction' setting " << DM_interaction << " in configuration file not recognized." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in obscura::Configuration::Construct_DM_Particle(): 'DM_interaction' setting " << DM_interaction << " in configuration file not recognized." << std::endl;
std::exit(EXIT_FAILURE);
}

Expand All @@ -233,7 +233,7 @@ void Configuration::Construct_DM_Particle_Standard(std::string DM_interaction)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Construct_DM_Particle_Standard(): No 'DM_form_factor' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Construct_DM_Particle_Standard(): No 'DM_form_factor' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
if(DM_form_factor == "General")
Expand All @@ -244,14 +244,14 @@ void Configuration::Construct_DM_Particle_Standard(std::string DM_interaction)
DM_mediator_mass *= MeV;
if(DM_mediator_mass < 1e-60)
{
std::cout << "Error in Configuration::Construct_DM_Particle_Standard:\tMediator mass for \"General\" form factor needs to be positive. (DM_mediator_mass = " << DM_mediator_mass / MeV << " MeV)\n"
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Construct_DM_Particle_Standard:\tMediator mass for \"General\" form factor needs to be positive. (DM_mediator_mass = " << DM_mediator_mass / MeV << " MeV)\n"
<< std::endl;
std::exit(EXIT_FAILURE);
}
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Construct_DM_Particle_Standard(): No 'DM_mediator_mass' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Construct_DM_Particle_Standard(): No 'DM_mediator_mass' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
}
Expand All @@ -272,7 +272,7 @@ void Configuration::Construct_DM_Particle_Standard(std::string DM_interaction)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Construct_DM_Particle_Standard(): No 'DM_isospin_conserved' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Construct_DM_Particle_Standard(): No 'DM_isospin_conserved' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
double fp_rel, fn_rel;
Expand All @@ -290,7 +290,7 @@ void Configuration::Construct_DM_Particle_Standard(std::string DM_interaction)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Construct_DM_Particle_Standard(): No 'DM_relative_couplings' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Construct_DM_Particle_Standard(): No 'DM_relative_couplings' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
}
Expand All @@ -304,7 +304,7 @@ void Configuration::Construct_DM_Particle_Standard(std::string DM_interaction)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Construct_DM_Particle_Standard(): No 'DM_cross_section_nucleon' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Construct_DM_Particle_Standard(): No 'DM_cross_section_nucleon' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
DM->Set_Interaction_Parameter(DM_cross_section_nucleon, "Nuclei");
Expand All @@ -317,7 +317,7 @@ void Configuration::Construct_DM_Particle_Standard(std::string DM_interaction)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Construct_DM_Particle_Standard(): No 'DM_cross_section_electron' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Construct_DM_Particle_Standard(): No 'DM_cross_section_electron' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
DM->Set_Sigma_Electron(DM_cross_section_electron);
Expand All @@ -342,7 +342,7 @@ void Configuration::Construct_DM_Distribution()
Construct_Imported_Distribution();
else
{
std::cerr << "Error in obscura::Configuration::Construct_DM_Distribution(): 'DM_distribution' setting " << DM_distribution << " in configuration file not recognized." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in obscura::Configuration::Construct_DM_Distribution(): 'DM_distribution' setting " << DM_distribution << " in configuration file not recognized." << std::endl;
std::exit(EXIT_FAILURE);
}
}
Expand All @@ -358,7 +358,7 @@ void Configuration::Construct_DM_Halo_Model(std::string model_label)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Construct_DM_Distribution_SHM(): No 'DM_local_density' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Construct_DM_Distribution_SHM(): No 'DM_local_density' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
try
Expand All @@ -368,15 +368,15 @@ void Configuration::Construct_DM_Halo_Model(std::string model_label)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Construct_DM_Distribution_SHM(): No 'SHM_v0' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Construct_DM_Distribution_SHM(): No 'SHM_v0' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
try
{
int entries = config.lookup("SHM_vObserver").getLength();
if(entries != 3)
{
std::cerr << "Error in Construct_DM_Distribution_SHM(): 'SHM_vObserver' is a " << entries << "-dimensional vector, not 3." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Construct_DM_Distribution_SHM(): 'SHM_vObserver' is a " << entries << "-dimensional vector, not 3." << std::endl;
std::exit(EXIT_FAILURE);
}
for(int i = 0; i < 3; i++)
Expand All @@ -385,7 +385,7 @@ void Configuration::Construct_DM_Halo_Model(std::string model_label)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Construct_DM_Distribution_SHM(): No 'SHM_vObserver' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Construct_DM_Distribution_SHM(): No 'SHM_vObserver' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
try
Expand All @@ -395,7 +395,7 @@ void Configuration::Construct_DM_Halo_Model(std::string model_label)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Construct_DM_Distribution_SHM(): No 'SHM_vEscape' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Construct_DM_Distribution_SHM(): No 'SHM_vEscape' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
if(model_label == "SHM")
Expand All @@ -409,7 +409,7 @@ void Configuration::Construct_DM_Halo_Model(std::string model_label)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Construct_DM_Distribution_SHM(): No 'SHMpp_eta' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Construct_DM_Distribution_SHM(): No 'SHMpp_eta' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
try
Expand All @@ -418,7 +418,7 @@ void Configuration::Construct_DM_Halo_Model(std::string model_label)
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Construct_DM_Distribution_SHM(): No 'SHMpp_beta' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Construct_DM_Distribution_SHM(): No 'SHMpp_beta' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
DM_distr = new SHM_Plus_Plus(DM_local_density, SHM_v0, vel_observer, SHM_vEscape, eta, beta);
Expand All @@ -435,7 +435,7 @@ void Configuration::Construct_Imported_Distribution()
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Construct_DM_Distribution_SHM(): No 'DM_local_density' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Construct_DM_Distribution_SHM(): No 'DM_local_density' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
std::string file_path;
Expand Down Expand Up @@ -515,7 +515,7 @@ void Configuration::Construct_DM_Detector()

else
{
std::cerr << "Error in obscura::Configuration::Construct_DM_Detector(): Experiment " << DD_experiment << " not recognized." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in obscura::Configuration::Construct_DM_Detector(): Experiment " << DD_experiment << " not recognized." << std::endl;
std::exit(EXIT_FAILURE);
}
}
Expand Down Expand Up @@ -766,7 +766,7 @@ void Configuration::Initialize_Parameters()
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Initialize_Parameters(): No 'constraints_certainty' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Initialize_Parameters(): No 'constraints_certainty' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}

Expand All @@ -776,7 +776,7 @@ void Configuration::Initialize_Parameters()
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Initialize_Parameters(): No 'constraints_mass_min' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Initialize_Parameters(): No 'constraints_mass_min' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}

Expand All @@ -786,7 +786,7 @@ void Configuration::Initialize_Parameters()
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Initialize_Parameters(): No 'constraints_mass_max' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Initialize_Parameters(): No 'constraints_mass_max' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}

Expand All @@ -796,7 +796,7 @@ void Configuration::Initialize_Parameters()
}
catch(const SettingNotFoundException& nfex)
{
std::cerr << "Error in Configuration::Initialize_Parameters(): No 'constraints_masses' setting in configuration file." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in Configuration::Initialize_Parameters(): No 'constraints_masses' setting in configuration file." << std::endl;
std::exit(EXIT_FAILURE);
}
}
Expand Down
19 changes: 14 additions & 5 deletions src/DM_Distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace obscura
using namespace libphysica::natural_units;

// 1. Abstract base class for DM distributions that can be used to compute direct detection recoil spectra.
//Constructors:
// Constructors:
DM_Distribution::DM_Distribution()
: name("DM base distribution"), v_domain(std::vector<double> {0.0, 1.0}), DM_density(0.0), DD_use_eta_function(false)
{
Expand Down Expand Up @@ -101,7 +101,7 @@ double DM_Distribution::Average_Speed(double vMin)
}
else if(vMin < v_domain[0] || vMin >= v_domain[1])
{
std::cerr << "Error in DM_Distribution::Average_Speed(): vMin = " << In_Units(vMin, km / sec) << "lies outside the domain [" << In_Units(v_domain[0], km / sec) << "," << In_Units(v_domain[1], km / sec) << "]" << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in DM_Distribution::Average_Speed(): vMin = " << In_Units(vMin, km / sec) << "lies outside the domain [" << In_Units(v_domain[0], km / sec) << "," << In_Units(v_domain[1], km / sec) << "]" << std::endl;
std::exit(EXIT_FAILURE);
}

Expand All @@ -122,7 +122,7 @@ double DM_Distribution::Eta_Function_Base(double vMin)
{
if(vMin < v_domain[0])
{
std::cerr << "Error in obscura::DM_Distribution::Eta_Function_Base(): vMin = " << In_Units(vMin, km / sec) << "km/sec lies below the domain [" << In_Units(v_domain[0], km / sec) << "km/sec," << In_Units(v_domain[1], km / sec) << "km/sec]." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in obscura::DM_Distribution::Eta_Function_Base(): vMin = " << In_Units(vMin, km / sec) << "km/sec lies below the domain [" << In_Units(v_domain[0], km / sec) << "km/sec," << In_Units(v_domain[1], km / sec) << "km/sec]." << std::endl;
std::exit(EXIT_FAILURE);
}
else if(vMin >= v_domain[1])
Expand Down Expand Up @@ -184,7 +184,7 @@ void Imported_DM_Distribution::Check_Normalization()
{
double norm = pdf_speed.Integrate(v_domain[0], v_domain[1]);
if(libphysica::Relative_Difference(norm, 1.0) > 1.0e-3)
std::cout << "Warning in obscura::Imported_DM_Distribution::Check_Normalization(): Imported pdf is not normalized (norm = " << norm << ")." << std::endl
std::cerr << libphysica::Formatted_String("Warning", "Yellow", true) << " in obscura::Imported_DM_Distribution::Check_Normalization(): Imported pdf is not normalized (norm = " << norm << ")." << std::endl
<< std::endl;
}

Expand All @@ -208,6 +208,15 @@ Imported_DM_Distribution::Imported_DM_Distribution(double rho, const std::string
Interpolate_Eta();
}

Imported_DM_Distribution::Imported_DM_Distribution(std::vector<std::vector<double>>& pdf_table, double rho)
: DM_Distribution("Tabulated DM distribution", rho, 0.0, 1.0), file_path("-")
{
pdf_speed = libphysica::Interpolation(pdf_table);
v_domain = pdf_speed.domain;
Check_Normalization();
Interpolate_Eta();
}

double Imported_DM_Distribution::PDF_Speed(double v)
{
if(v < v_domain[0] || v > v_domain[1])
Expand All @@ -220,7 +229,7 @@ double Imported_DM_Distribution::Eta_Function(double vMin)
{
if(vMin < v_domain[0])
{
std::cerr << "Error in obscura::Imported_DM_Distribution::Eta_Function(): vMin = " << In_Units(vMin, km / sec) << "km/sec lies below the domain [" << In_Units(v_domain[0], km / sec) << "km/sec," << In_Units(v_domain[1], km / sec) << "km/sec]." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in obscura::Imported_DM_Distribution::Eta_Function(): vMin = " << In_Units(vMin, km / sec) << "km/sec lies below the domain [" << In_Units(v_domain[0], km / sec) << "km/sec," << In_Units(v_domain[1], km / sec) << "km/sec]." << std::endl;
std::exit(EXIT_FAILURE);
}
else if(vMin > v_domain[1])
Expand Down
2 changes: 1 addition & 1 deletion src/DM_Halo_Models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ double SHM_Plus_Plus::Eta_Function(double vMin)
{
if(vMin < v_domain[0])
{
std::cerr << "Error in obscura::SHM_Plus_Plus::Eta_Function: vMin = " << In_Units(vMin, km / sec) << "km/sec lies below the domain [" << In_Units(v_domain[0], km / sec) << "km/sec," << In_Units(v_domain[1], km / sec) << "km/sec]." << std::endl;
std::cerr << libphysica::Formatted_String("Error", "Red", true) << " in obscura::SHM_Plus_Plus::Eta_Function: vMin = " << In_Units(vMin, km / sec) << "km/sec lies below the domain [" << In_Units(v_domain[0], km / sec) << "km/sec," << In_Units(v_domain[1], km / sec) << "km/sec]." << std::endl;
std::exit(EXIT_FAILURE);
}
else if(vMin > v_domain[1])
Expand Down
Loading

0 comments on commit e6a47a5

Please sign in to comment.