sed success!

This commit is contained in:
caes 2017-08-10 04:05:56 -04:00
parent 43dd15864a
commit ba16e5e194
7 changed files with 1027 additions and 1037 deletions

View File

@ -1,8 +1,9 @@
0.0003 0.002 #0.001 0.007
#0.0003 0.002
0.001 0.0072 0.001 0.0072
0.008 0.04 0.008 0.04
0.012 0.044 0.012 0.044
0.03 0.025 #0.03 0.025
0.44 0.024 0.44 0.024
2.1 0.012 2.1 0.012
60.0 0.029 60.0 0.029

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
12.00 -9
0.0004 3.2e10 0.0004 3.2e10
0.006 4.9e13 0.006 4.9e13
.4 2.2e13 .4 2.2e13

View File

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

View File

@ -37,6 +37,11 @@ struct sed_table {
// To account for the four main powerlaws in a typical // To account for the four main powerlaws in a typical
// AGN SED. // AGN SED.
// Hardcoded infrared and gamma ray power laws.
const double IR_POWER = 3;
const double GAMMA_POWER = -2;
struct powerlaw_bounds { struct powerlaw_bounds {
double ir_min; double ir_min;
double ir_max; double ir_max;
@ -183,10 +188,8 @@ agn::sed_powerlaw_spline::sed_powerlaw_spline(
// powerlaws are evaluated across four regions of the sed, first // powerlaws are evaluated across four regions of the sed, first
// we construct the powerlaws, here, and locate them // we construct the powerlaws, here, and locate them
iterator1d table_it = powerlaw_coords.table.begin(); iterator1d table_it = powerlaw_coords.table.begin();
double ir_power = (*table_it).first; double ir_power = agn::IR_POWER;
double gamma_power = (*table_it).second; double gamma_power = agn::GAMMA_POWER;
std::cout << ir_power << ", " << gamma_power;
table_it++;
coord2d ir_high_point = *table_it; table_it++; coord2d ir_high_point = *table_it; table_it++;
coord2d uv_low_point = *table_it; table_it++; coord2d uv_low_point = *table_it; table_it++;
coord2d uv_high_point = *table_it; table_it++; coord2d uv_high_point = *table_it; table_it++;
@ -385,34 +388,17 @@ double agn::sed_pow_law::SED_at_2KeV() {
agn::sed_table agn::read_sed_table(std::ifstream& table_file) { agn::sed_table agn::read_sed_table(std::ifstream& table_file) {
sed_table resultant; sed_table resultant;
std::string scratch; std::string line;
double hnu; double hnu;
std::getline(table_file,scratch); if(!isdigit(table_file.peek()) && table_file.peek() != '#') {
if(!isdigit(scratch[0])) { std::getline(table_file,resultant.header);
resultant.header = scratch;
} }
else
table_file.seekg(0);
while(!table_file.eof()) { while(!table_file.eof()) {
char next; std::getline(table_file,line);
next = table_file.peek(); if (line[0] == '#') continue;
if (next == '\n'){ std::stringstream scratch(line);
table_file.get(); scratch >> hnu;
next = table_file.peek(); scratch >> resultant.table[hnu];
}
if (next == '#') {
char commented;
while (commented != '\n') {
if(table_file.eof() || table_file.fail())
break;
table_file.get(commented);
}
if(table_file.eof() || table_file.fail())
break;
next = table_file.peek();
}
table_file >> hnu;
table_file >> resultant.table[hnu];
} }
return resultant; return resultant;
} }

View File

@ -3,7 +3,9 @@
// Syntax: table_powerlaw_spline <samples table> <powerlaw coordinates> <output table> // Syntax: table_powerlaw_spline <samples table> <powerlaw coordinates> <output table>
namespace agn {
bool sed_debug =true;
}
int main(int argc, char const *argv[]) int main(int argc, char const *argv[])
{ {
@ -46,12 +48,14 @@ 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);
if(agn::debug) debug_file if(agn::sed_debug) debug_file
<< "Read samples:\n" << "Read "
<< samples.table.size()
<< " samples:\n"
<< format_sed_table(samples); << format_sed_table(samples);
powerlaw_coords = agn::read_sed_table(powerlaw_table); powerlaw_coords = agn::read_sed_table(powerlaw_table);
if(agn::debug) debug_file if(agn::sed_debug) debug_file
<< "Read power coords:\n" << "Read power coords:\n"
<< format_sed_table(powerlaw_coords); << format_sed_table(powerlaw_coords);