spline program running

This commit is contained in:
caes 2017-08-08 07:21:30 -04:00
parent 4450f6d9f8
commit a530c8054f
4 changed files with 9 additions and 12 deletions

View File

@ -1,9 +0,0 @@
0.0003 0.002
0.001 0.0072
0.008 0.04
0.012 0.044
0.03 0.05
0.44 0.04
2.1 0.012
60.0 0.029
410.0 0.0003

View File

@ -17,7 +17,7 @@
namespace agn { namespace agn {
const bool debug = false; const bool debug = true;
const bool line_debug = false; const bool line_debug = false;
const bool verbose=true; const bool verbose=true;

View File

@ -37,12 +37,15 @@ int main(int argc, char const *argv[])
// Read in sampling table and construct a spline model. // Read in sampling table and construct a spline model.
samples = agn::read_sed_table(sample_table); samples = agn::read_sed_table(sample_table);
agn::sed_spline agnsource(samples);
if(agn::debug) debug_file if(agn::debug) debug_file
<< "Read samples:\n" << "Read samples:\n"
<< format_sed_table(samples); << format_sed_table(samples);
agn::sed_spline agnsource(samples);
if(agn::verbose) std::cout if(agn::verbose) std::cout
<< "Evaluating relative spectral intensity for " << "Evaluating relative spectral intensity for "

View File

@ -153,6 +153,7 @@ agn::sed_spline::sed_spline(agn::sed_table& samples) {
while(table_it != samples.value.end()) { while(table_it != samples.value.end()) {
x.push_back(table_it->first); x.push_back(table_it->first);
y.push_back(table_it->second); y.push_back(table_it->second);
table_it++;
} }
Spline<double,double> newspline(x,y); Spline<double,double> newspline(x,y);
_spline = newspline; _spline = newspline;
@ -266,6 +267,7 @@ agn::sed_table agn::read_sed_table(std::ifstream& table_file) {
table_file >> hnu; table_file >> hnu;
table_file >> resultant.value[hnu]; table_file >> resultant.value[hnu];
} }
return resultant;
} }
@ -298,6 +300,7 @@ std::string agn::format_sed_table(agn::sed_table table) {
while(table_iterator != table.value.end()) { while(table_iterator != table.value.end()) {
output output
<< std::fixed << std::fixed
<< std::scientific
<< table_iterator->first << table_iterator->first
<< "\t" << "\t"
<< std::scientific << std::scientific