From 43dd15864ad3e9f5dcb179d0587a27b2ebdb5fcf Mon Sep 17 00:00:00 2001 From: caes Date: Thu, 10 Aug 2017 02:32:51 -0400 Subject: [PATCH] sed program starting to work --- sed/mehdipour2013/mehdipour2013.tab | 1000 +++++++++++++++++ .../mehdipour2013_powlaw_coords.tab | 3 +- sed/mehdipour2013/mehdipour2013_samples.tab | 4 +- src/sed.hpp | 174 ++- src/table_powerlaw_spline_sed.cpp | 10 +- 5 files changed, 1143 insertions(+), 48 deletions(-) create mode 100644 sed/mehdipour2013/mehdipour2013.tab diff --git a/sed/mehdipour2013/mehdipour2013.tab b/sed/mehdipour2013/mehdipour2013.tab new file mode 100644 index 0000000..058cbc5 --- /dev/null +++ b/sed/mehdipour2013/mehdipour2013.tab @@ -0,0 +1,1000 @@ +1.36193e-07 4.87909e+13 +1.40936e-07 4.87915e+13 +1.45843e-07 4.87922e+13 +1.50922e-07 4.87929e+13 +1.56178e-07 4.87935e+13 +1.61616e-07 4.87942e+13 +1.67244e-07 4.87949e+13 +1.73068e-07 4.87955e+13 +1.79095e-07 4.87962e+13 +1.85332e-07 4.87969e+13 +1.91785e-07 4.87975e+13 +1.98464e-07 4.87982e+13 +2.05375e-07 4.87989e+13 +2.12527e-07 4.87995e+13 +2.19928e-07 4.88002e+13 +2.27586e-07 4.88009e+13 +2.35512e-07 4.88016e+13 +2.43713e-07 4.88022e+13 +2.52200e-07 4.88029e+13 +2.60982e-07 4.88036e+13 +2.70070e-07 4.88042e+13 +2.79475e-07 4.88049e+13 +2.89207e-07 4.88056e+13 +2.99278e-07 4.88062e+13 +3.09700e-07 4.88069e+13 +3.20484e-07 4.88076e+13 +3.31645e-07 4.88082e+13 +3.43194e-07 4.88089e+13 +3.55145e-07 4.88096e+13 +3.67512e-07 4.88102e+13 +3.80310e-07 4.88109e+13 +3.93553e-07 4.88116e+13 +4.07258e-07 4.88122e+13 +4.21440e-07 4.88129e+13 +4.36116e-07 4.88136e+13 +4.51303e-07 4.88142e+13 +4.67018e-07 4.88149e+13 +4.83281e-07 4.88156e+13 +5.00111e-07 4.88163e+13 +5.17526e-07 4.88169e+13 +5.35548e-07 4.88176e+13 +5.54197e-07 4.88183e+13 +5.73496e-07 4.88189e+13 +5.93467e-07 4.88196e+13 +6.14133e-07 4.88203e+13 +6.35519e-07 4.88209e+13 +6.57650e-07 4.88216e+13 +6.80551e-07 4.88223e+13 +7.04250e-07 4.88229e+13 +7.28774e-07 4.88236e+13 +7.54153e-07 4.88243e+13 +7.80414e-07 4.88249e+13 +8.07591e-07 4.88256e+13 +8.35714e-07 4.88263e+13 +8.64816e-07 4.88269e+13 +8.94931e-07 4.88276e+13 +9.26095e-07 4.88283e+13 +9.58345e-07 4.88290e+13 +9.91717e-07 4.88296e+13 +1.02625e-06 4.88303e+13 +1.06199e-06 4.88310e+13 +1.09897e-06 4.88316e+13 +1.13724e-06 4.88323e+13 +1.17684e-06 4.88330e+13 +1.21782e-06 4.88336e+13 +1.26023e-06 4.88343e+13 +1.30412e-06 4.88350e+13 +1.34953e-06 4.88356e+13 +1.39653e-06 4.88363e+13 +1.44516e-06 4.88370e+13 +1.49548e-06 4.88376e+13 +1.54756e-06 4.88383e+13 +1.60145e-06 4.88390e+13 +1.65722e-06 4.88397e+13 +1.71493e-06 4.88403e+13 +1.77464e-06 4.88410e+13 +1.83644e-06 4.88417e+13 +1.90039e-06 4.88423e+13 +1.96657e-06 4.88430e+13 +2.03505e-06 4.88437e+13 +2.10592e-06 4.88443e+13 +2.17925e-06 4.88450e+13 +2.25514e-06 4.88457e+13 +2.33367e-06 4.88463e+13 +2.41494e-06 4.88470e+13 +2.49904e-06 4.88477e+13 +2.58606e-06 4.88483e+13 +2.67611e-06 4.88490e+13 +2.76930e-06 4.88497e+13 +2.86574e-06 4.88504e+13 +2.96553e-06 4.88510e+13 +3.06880e-06 4.88517e+13 +3.17567e-06 4.88524e+13 +3.28625e-06 4.88530e+13 +3.40069e-06 4.88537e+13 +3.51911e-06 4.88544e+13 +3.64166e-06 4.88550e+13 +3.76847e-06 4.88557e+13 +3.89970e-06 4.88564e+13 +4.03550e-06 4.88570e+13 +4.17603e-06 4.88577e+13 +4.32145e-06 4.88584e+13 +4.47194e-06 4.88590e+13 +4.62767e-06 4.88597e+13 +4.78881e-06 4.88604e+13 +4.95558e-06 4.88611e+13 +5.12814e-06 4.88617e+13 +5.30672e-06 4.88624e+13 +5.49152e-06 4.88631e+13 +5.68275e-06 4.88637e+13 +5.88064e-06 4.88644e+13 +6.08542e-06 4.88651e+13 +6.29733e-06 4.88657e+13 +6.51663e-06 4.88664e+13 +6.74356e-06 4.88671e+13 +6.97839e-06 4.88677e+13 +7.22140e-06 4.88684e+13 +7.47287e-06 4.88691e+13 +7.73309e-06 4.88698e+13 +8.00238e-06 4.88704e+13 +8.28105e-06 4.88711e+13 +8.56942e-06 4.88718e+13 +8.86784e-06 4.88724e+13 +9.17664e-06 4.88731e+13 +9.49620e-06 4.88738e+13 +9.82689e-06 4.88744e+13 +1.01691e-05 4.88751e+13 +1.05232e-05 4.88758e+13 +1.08897e-05 4.88764e+13 +1.12689e-05 4.88771e+13 +1.16613e-05 4.88778e+13 +1.20674e-05 4.88785e+13 +1.24876e-05 4.88791e+13 +1.29224e-05 4.88798e+13 +1.33724e-05 4.88805e+13 +1.38381e-05 4.88811e+13 +1.43200e-05 4.88818e+13 +1.48187e-05 4.88825e+13 +1.53347e-05 4.88831e+13 +1.58687e-05 4.88838e+13 +1.64213e-05 4.88845e+13 +1.69931e-05 4.88851e+13 +1.75849e-05 4.88858e+13 +1.81972e-05 4.88865e+13 +1.88309e-05 4.88872e+13 +1.94867e-05 4.88878e+13 +2.01653e-05 4.88885e+13 +2.08675e-05 4.88892e+13 +2.15941e-05 4.88898e+13 +2.23461e-05 4.88905e+13 +2.31243e-05 4.88912e+13 +2.39295e-05 4.88918e+13 +2.47628e-05 4.88925e+13 +2.56252e-05 4.88932e+13 +2.65175e-05 4.88938e+13 +2.74409e-05 4.88945e+13 +2.83965e-05 4.88952e+13 +2.93853e-05 4.88959e+13 +3.04086e-05 4.88965e+13 +3.14676e-05 4.88972e+13 +3.25633e-05 4.88979e+13 +3.36973e-05 4.88985e+13 +3.48707e-05 4.88992e+13 +3.60851e-05 4.88999e+13 +3.73416e-05 4.89005e+13 +3.86420e-05 4.89012e+13 +3.99876e-05 4.89019e+13 +4.13801e-05 4.89026e+13 +4.28211e-05 4.89032e+13 +4.43123e-05 4.89039e+13 +4.58553e-05 4.89046e+13 +4.74522e-05 4.89052e+13 +4.91046e-05 4.89059e+13 +5.08146e-05 4.89066e+13 +5.25841e-05 4.89072e+13 +5.44152e-05 4.89079e+13 +5.63101e-05 4.89086e+13 +5.82710e-05 4.89092e+13 +6.03002e-05 4.89099e+13 +6.24000e-05 4.89106e+13 +6.45730e-05 4.89113e+13 +6.68216e-05 4.89119e+13 +6.91485e-05 4.89126e+13 +7.15565e-05 4.89133e+13 +7.40483e-05 4.89139e+13 +7.66269e-05 4.89146e+13 +7.92953e-05 4.89153e+13 +8.20566e-05 4.89159e+13 +8.49141e-05 4.89166e+13 +8.78710e-05 4.89173e+13 +9.09310e-05 4.89180e+13 +9.40974e-05 4.89186e+13 +9.73742e-05 4.89193e+13 +1.00765e-04 4.89200e+13 +1.04274e-04 4.89206e+13 +1.07905e-04 4.89213e+13 +1.11663e-04 4.89220e+13 +1.15551e-04 4.89226e+13 +1.19575e-04 4.89233e+13 +1.23739e-04 4.89240e+13 +1.28048e-04 4.89247e+13 +1.32507e-04 4.89253e+13 +1.37121e-04 4.89260e+13 +1.41896e-04 4.89267e+13 +1.46838e-04 4.89273e+13 +1.51951e-04 4.89280e+13 +1.57242e-04 4.89287e+13 +1.62718e-04 4.89293e+13 +1.68384e-04 4.89300e+13 +1.74248e-04 4.89307e+13 +1.80316e-04 4.89314e+13 +1.86595e-04 4.89320e+13 +1.93093e-04 4.89327e+13 +1.99817e-04 4.89334e+13 +2.06775e-04 4.89340e+13 +2.13975e-04 4.89347e+13 +2.21427e-04 4.89354e+13 +2.29137e-04 4.89360e+13 +2.37117e-04 4.89367e+13 +2.45374e-04 4.89374e+13 +2.53919e-04 4.89381e+13 +2.62761e-04 4.89387e+13 +2.71911e-04 4.89394e+13 +2.81380e-04 4.89401e+13 +2.91178e-04 4.89407e+13 +3.01318e-04 4.89414e+13 +3.11811e-04 4.89421e+13 +3.22669e-04 4.89427e+13 +3.33905e-04 4.89434e+13 +3.45533e-04 4.89441e+13 +3.57565e-04 4.89448e+13 +3.70017e-04 4.89454e+13 +3.82902e-04 4.89461e+13 +3.96236e-04 4.89468e+13 +4.10034e-04 4.89474e+13 +4.24312e-04 4.89481e+13 +4.39088e-04 4.89488e+13 +4.54379e-04 4.89494e+13 +4.70202e-04 4.89501e+13 +4.86575e-04 4.89508e+13 +5.03519e-04 4.89515e+13 +5.21053e-04 4.89521e+13 +5.39198e-04 4.89528e+13 +5.57975e-04 4.89535e+13 +5.77405e-04 4.89541e+13 +5.97512e-04 4.89548e+13 +6.18319e-04 4.89555e+13 +6.39851e-04 4.89561e+13 +6.62133e-04 4.89568e+13 +6.85190e-04 4.89575e+13 +7.09050e-04 4.89582e+13 +7.33742e-04 4.89588e+13 +7.59293e-04 4.89595e+13 +7.85734e-04 4.89602e+13 +8.13095e-04 4.89608e+13 +8.41410e-04 4.89615e+13 +8.70710e-04 4.89622e+13 +9.01031e-04 4.89629e+13 +9.32408e-04 4.89635e+13 +9.64877e-04 4.89642e+13 +9.98477e-04 4.89649e+13 +1.03325e-03 4.89655e+13 +1.06923e-03 4.89662e+13 +1.10646e-03 4.89669e+13 +1.14499e-03 4.89675e+13 +1.18486e-03 4.89682e+13 +1.22612e-03 4.89689e+13 +1.26882e-03 4.89696e+13 +1.31301e-03 4.89702e+13 +1.35873e-03 4.89709e+13 +1.40604e-03 4.89716e+13 +1.45501e-03 4.89722e+13 +1.50567e-03 4.89729e+13 +1.55811e-03 4.89736e+13 +1.61236e-03 4.89743e+13 +1.66851e-03 4.89749e+13 +1.72661e-03 4.89756e+13 +1.78674e-03 4.89763e+13 +1.84896e-03 4.89769e+13 +1.91335e-03 4.89776e+13 +1.97998e-03 4.89783e+13 +2.04892e-03 4.89789e+13 +2.12027e-03 4.89796e+13 +2.19411e-03 4.89803e+13 +2.27051e-03 4.89810e+13 +2.34958e-03 4.89816e+13 +2.43140e-03 4.89823e+13 +2.51607e-03 4.89830e+13 +2.60369e-03 4.89836e+13 +2.69435e-03 4.89843e+13 +2.78818e-03 4.89850e+13 +2.88527e-03 4.89857e+13 +2.98575e-03 4.89863e+13 +3.08972e-03 4.89870e+13 +3.19731e-03 4.89877e+13 +3.30865e-03 4.89883e+13 +3.42387e-03 4.89890e+13 +3.54310e-03 4.89897e+13 +3.66648e-03 4.89903e+13 +3.79416e-03 4.89910e+13 +3.92628e-03 4.89917e+13 +4.06301e-03 4.89924e+13 +4.20449e-03 4.89930e+13 +4.35091e-03 4.89937e+13 +4.50242e-03 4.89944e+13 +4.65921e-03 4.89950e+13 +4.82146e-03 4.89957e+13 +4.98935e-03 4.89964e+13 +5.16310e-03 4.89971e+13 +5.34289e-03 4.89977e+13 +5.52895e-03 4.89984e+13 +5.72148e-03 4.89991e+13 +5.92072e-03 4.89997e+13 +6.12690e-03 nan +6.34026e-03 nan +6.56104e-03 nan +6.78952e-03 nan +7.02595e-03 nan +7.27062e-03 nan +7.52380e-03 nan +7.78580e-03 nan +8.05693e-03 nan +8.33749e-03 nan +8.62783e-03 nan +8.92828e-03 nan +9.23919e-03 nan +9.56093e-03 nan +9.89387e-03 nan +1.02384e-02 nan +1.05949e-02 nan +1.09639e-02 nan +1.13457e-02 nan +1.17408e-02 nan +1.21496e-02 nan +1.25727e-02 nan +1.30105e-02 nan +1.34636e-02 nan +1.39324e-02 nan +1.44176e-02 nan +1.49197e-02 nan +1.54392e-02 nan +1.59769e-02 nan +1.65332e-02 nan +1.71090e-02 nan +1.77047e-02 nan +1.83213e-02 nan +1.89593e-02 nan +1.96195e-02 nan +2.03027e-02 nan +2.10097e-02 nan +2.17413e-02 nan +2.24984e-02 nan +2.32819e-02 nan +2.40926e-02 nan +2.49316e-02 nan +2.57998e-02 nan +2.66982e-02 nan +2.76280e-02 nan +2.85900e-02 nan +2.95856e-02 nan +3.06159e-02 nan +3.16820e-02 nan +3.27853e-02 nan +3.39270e-02 nan +3.51084e-02 nan +3.63310e-02 nan +3.75962e-02 nan +3.89054e-02 nan +4.02602e-02 nan +4.16622e-02 nan +4.31130e-02 nan +4.46143e-02 nan +4.61679e-02 nan +4.77756e-02 nan +4.94393e-02 nan +5.11609e-02 nan +5.29425e-02 nan +5.47861e-02 nan +5.66939e-02 nan +5.86682e-02 nan +6.07112e-02 nan +6.28253e-02 nan +6.50131e-02 nan +6.72771e-02 nan +6.96199e-02 nan +7.20442e-02 nan +7.45530e-02 nan +7.71492e-02 nan +7.98358e-02 nan +8.26159e-02 nan +8.54928e-02 nan +8.84699e-02 nan +9.15507e-02 nan +9.47388e-02 nan +9.80379e-02 nan +1.01452e-01 nan +1.04985e-01 nan +1.08641e-01 nan +1.12424e-01 nan +1.16339e-01 nan +1.20390e-01 nan +1.24582e-01 nan +1.28921e-01 nan +1.33410e-01 nan +1.38056e-01 nan +1.42863e-01 nan +1.47838e-01 nan +1.52987e-01 nan +1.58314e-01 nan +1.63827e-01 nan +1.69532e-01 nan +1.75436e-01 nan +1.81545e-01 nan +1.87867e-01 nan +1.94409e-01 nan +2.01179e-01 nan +2.08184e-01 nan +2.15434e-01 nan +2.22936e-01 nan +2.30699e-01 nan +2.38733e-01 nan +2.47046e-01 nan +2.55649e-01 nan +2.64552e-01 nan +2.73764e-01 nan +2.83298e-01 nan +2.93163e-01 nan +3.03372e-01 nan +3.13936e-01 nan +3.24868e-01 nan +3.36181e-01 nan +3.47888e-01 nan +3.60002e-01 nan +3.72539e-01 nan +3.85512e-01 nan +3.98936e-01 nan +4.12829e-01 2.18058e+13 +4.27205e-01 2.15972e+13 +4.42081e-01 2.13906e+13 +4.57476e-01 2.11859e+13 +4.73406e-01 2.09833e+13 +4.89892e-01 2.07825e+13 +5.06951e-01 2.05837e+13 +5.24605e-01 2.03868e+13 +5.42873e-01 2.01917e+13 +5.61778e-01 1.99985e+13 +5.81341e-01 1.98072e+13 +6.01585e-01 1.96177e+13 +6.22534e-01 1.94300e+13 +6.44212e-01 1.92442e+13 +6.66646e-01 1.90600e+13 +6.89860e-01 1.88777e+13 +7.13883e-01 1.86971e+13 +7.38743e-01 1.85182e+13 +7.64468e-01 1.83411e+13 +7.91089e-01 1.81656e+13 +8.18637e-01 1.79918e+13 +8.47145e-01 1.78197e+13 +8.76645e-01 1.76492e+13 +9.07172e-01 1.74803e+13 +9.38763e-01 1.73131e+13 +9.71453e-01 1.71475e+13 +1.00528e+00 1.69834e+13 +1.04029e+00 1.68209e+13 +1.07652e+00 1.66600e+13 +1.11400e+00 1.65006e+13 +1.15280e+00 1.63428e+13 +1.19294e+00 1.61864e+13 +1.23448e+00 1.60316e+13 +1.27747e+00 1.58782e+13 +1.32196e+00 1.57263e+13 +1.36799e+00 1.55758e+13 +1.41563e+00 1.54268e+13 +1.46492e+00 1.52792e+13 +1.51594e+00 1.51330e+13 +1.56873e+00 1.49883e+13 +1.62335e+00 1.48449e+13 +1.67988e+00 1.47028e+13 +1.73838e+00 1.45622e+13 +1.79892e+00 1.44229e+13 +1.86156e+00 1.42849e+13 +1.92639e+00 1.41482e+13 +1.99347e+00 1.40129e+13 +2.06289e+00 nan +2.13473e+00 nan +2.20906e+00 nan +2.28599e+00 nan +2.36559e+00 nan +2.44797e+00 nan +2.53322e+00 nan +2.62143e+00 nan +2.71272e+00 nan +2.80718e+00 nan +2.90494e+00 nan +3.00610e+00 nan +3.11078e+00 nan +3.21911e+00 nan +3.33120e+00 nan +3.44721e+00 nan +3.56725e+00 nan +3.69147e+00 nan +3.82002e+00 nan +3.95304e+00 nan +4.09070e+00 nan +4.23315e+00 nan +4.38056e+00 nan +4.53311e+00 nan +4.69096e+00 nan +4.85432e+00 nan +5.02336e+00 nan +5.19829e+00 nan +5.37931e+00 nan +5.56663e+00 nan +5.76048e+00 nan +5.96108e+00 nan +6.16866e+00 nan +6.38347e+00 nan +6.60576e+00 nan +6.83580e+00 nan +7.07384e+00 nan +7.32017e+00 nan +7.57508e+00 nan +7.83887e+00 nan +8.11184e+00 nan +8.39432e+00 nan +8.68664e+00 nan +8.98913e+00 nan +9.30216e+00 nan +9.62609e+00 nan +9.96130e+00 nan +1.03082e+01 nan +1.06671e+01 nan +1.10386e+01 nan +1.14230e+01 nan +1.18208e+01 nan +1.22324e+01 nan +1.26584e+01 nan +1.30992e+01 nan +1.35554e+01 nan +1.40274e+01 nan +1.45159e+01 nan +1.50214e+01 nan +1.55444e+01 nan +1.60858e+01 nan +1.66459e+01 nan +1.72256e+01 nan +1.78254e+01 nan +1.84461e+01 nan +1.90885e+01 nan +1.97532e+01 nan +2.04411e+01 nan +2.11529e+01 nan +2.18895e+01 nan +2.26518e+01 nan +2.34406e+01 nan +2.42569e+01 nan +2.51015e+01 nan +2.59757e+01 nan +2.68802e+01 nan +2.78163e+01 nan +2.87849e+01 nan +2.97873e+01 nan +3.08246e+01 nan +3.18980e+01 nan +3.30088e+01 nan +3.41582e+01 nan +3.53477e+01 nan +3.65786e+01 nan +3.78524e+01 nan +3.91706e+01 nan +4.05346e+01 nan +4.19461e+01 nan +4.34068e+01 nan +4.49184e+01 nan +4.64826e+01 nan +4.81012e+01 nan +4.97763e+01 nan +5.15096e+01 nan +5.33033e+01 nan +5.51595e+01 nan +5.70804e+01 nan +5.90681e+01 nan +6.11250e+01 nan +6.32536e+01 nan +6.54562e+01 nan +6.77356e+01 nan +7.00944e+01 nan +7.25353e+01 nan +7.50612e+01 nan +7.76750e+01 nan +8.03799e+01 nan +8.31790e+01 nan +8.60755e+01 nan +8.90729e+01 nan +9.21747e+01 nan +9.53845e+01 nan +9.87061e+01 nan +1.02143e+02 nan +1.05700e+02 nan +1.09381e+02 nan +1.13190e+02 nan +1.17132e+02 nan +1.21211e+02 nan +1.25432e+02 nan +1.29799e+02 nan +1.34319e+02 nan +1.38997e+02 nan +1.43837e+02 nan +1.48846e+02 nan +1.54029e+02 nan +1.59393e+02 nan +1.64944e+02 nan +1.70687e+02 nan +1.76631e+02 nan +1.82782e+02 nan +1.89147e+02 nan +1.95734e+02 nan +2.02550e+02 nan +2.09603e+02 nan +2.16902e+02 nan +2.24455e+02 nan +2.32272e+02 nan +2.40360e+02 -nan +2.48730e+02 -nan +2.57392e+02 -nan +2.66355e+02 -nan +2.75630e+02 -nan +2.85228e+02 -nan +2.95161e+02 -nan +3.05439e+02 -nan +3.16076e+02 -nan +3.27082e+02 -nan +3.38472e+02 -nan +3.50259e+02 -nan +3.62456e+02 -nan +3.75078e+02 -nan +3.88139e+02 -nan +4.01656e+02 -nan +4.15642e+02 -nan +4.30116e+02 -nan +4.45094e+02 -nan +4.60594e+02 -nan +4.76633e+02 -nan +4.93231e+02 -nan +5.10407e+02 -nan +5.28181e+02 -nan +5.46574e+02 -nan +5.65607e+02 -nan +5.85303e+02 -nan +6.05685e+02 -nan +6.26777e+02 -nan +6.48603e+02 -nan +6.71189e+02 -nan +6.94562e+02 -nan +7.18749e+02 -nan +7.43778e+02 -nan +7.69679e+02 -nan +7.96481e+02 -nan +8.24217e+02 -nan +8.52919e+02 -nan +8.82620e+02 -nan +9.13356e+02 -nan +9.45161e+02 -nan +9.78075e+02 -nan +1.01213e+03 -nan +1.04738e+03 -nan +1.08385e+03 -nan +1.12160e+03 -nan +1.16065e+03 -nan +1.20107e+03 -nan +1.24290e+03 -nan +1.28618e+03 -nan +1.33097e+03 -nan +1.37731e+03 -nan +1.42528e+03 -nan +1.47491e+03 -nan +1.52627e+03 -nan +1.57942e+03 -nan +1.63442e+03 -nan +1.69133e+03 -nan +1.75023e+03 -nan +1.81118e+03 -nan +1.87425e+03 -nan +1.93952e+03 -nan +2.00706e+03 -nan +2.07695e+03 -nan +2.14928e+03 -nan +2.22412e+03 -nan +2.30157e+03 -nan +2.38172e+03 -nan +2.46466e+03 -nan +2.55048e+03 -nan +2.63930e+03 -nan +2.73121e+03 -nan +2.82632e+03 -nan +2.92474e+03 -nan +3.02659e+03 -nan +3.13198e+03 -nan +3.24105e+03 -nan +3.35391e+03 -nan +3.47070e+03 -nan +3.59156e+03 -nan +3.71663e+03 -nan +3.84606e+03 -nan +3.97999e+03 -nan +4.11858e+03 -nan +4.26200e+03 -nan +4.41042e+03 -nan +4.56401e+03 -nan +4.72294e+03 -nan +4.88740e+03 -nan +5.05760e+03 -nan +5.23372e+03 -nan +5.41597e+03 -nan +5.60457e+03 -nan +5.79974e+03 -nan +6.00171e+03 -nan +6.21071e+03 -nan +6.42698e+03 -nan +6.65079e+03 -nan +6.88239e+03 -nan +7.12205e+03 -nan +7.37007e+03 -nan +7.62671e+03 -nan +7.89230e+03 -nan +8.16713e+03 -nan +8.45154e+03 -nan +8.74585e+03 -nan +9.05040e+03 -nan +9.36557e+03 -nan +9.69170e+03 -nan +1.00292e+04 -nan +1.03784e+04 -nan +1.07399e+04 -nan +1.11138e+04 -nan +1.15009e+04 -nan +1.19014e+04 -nan +1.23158e+04 -nan +1.27447e+04 -nan +1.31885e+04 -nan +1.36477e+04 -nan +1.41230e+04 -nan +1.46148e+04 -nan +1.51237e+04 -nan +1.56504e+04 -nan +1.61954e+04 -nan +1.67594e+04 -nan +1.73430e+04 -nan +1.79469e+04 -nan +1.85719e+04 -nan +1.92186e+04 -nan +1.98879e+04 -nan +2.05804e+04 -nan +2.12971e+04 -nan +2.20387e+04 -nan +2.28062e+04 -nan +2.36003e+04 -nan +2.44222e+04 -nan +2.52726e+04 -nan +2.61527e+04 -nan +2.70634e+04 -nan +2.80059e+04 -nan +2.89811e+04 -nan +2.99903e+04 -nan +3.10347e+04 -nan +3.21154e+04 -nan +3.32337e+04 -nan +3.43910e+04 -nan +3.55886e+04 -nan +3.68280e+04 -nan +3.81104e+04 -nan +3.94375e+04 -nan +4.08109e+04 -nan +4.22320e+04 -nan +4.37027e+04 -nan +4.52245e+04 -nan +4.67994e+04 -nan +4.84291e+04 -nan +5.01155e+04 -nan +5.18607e+04 -nan +5.36667e+04 -nan +5.55355e+04 -nan +5.74694e+04 -nan +5.94707e+04 -nan +6.15416e+04 -nan +6.36847e+04 -nan +6.59024e+04 -nan +6.81973e+04 -nan +7.05721e+04 -nan +7.30297e+04 -nan +7.55728e+04 -nan +7.82045e+04 -nan +8.09278e+04 -nan +8.37459e+04 -nan +8.66622e+04 -nan +8.96801e+04 -nan +9.28030e+04 -nan +9.60347e+04 -nan +9.93789e+04 -nan +1.02840e+05 -nan +1.06421e+05 -nan +1.10127e+05 -nan +1.13962e+05 -nan +1.17930e+05 -nan +1.22037e+05 -nan +1.26286e+05 -nan +1.30684e+05 -nan +1.35235e+05 -nan +1.39944e+05 -nan +1.44818e+05 -nan +1.49861e+05 -nan +1.55079e+05 -nan +1.60479e+05 -nan +1.66068e+05 -nan +1.71851e+05 -nan +1.77835e+05 -nan +1.84028e+05 -nan +1.90436e+05 -nan +1.97068e+05 -nan +2.03930e+05 -nan +2.11032e+05 -nan +2.18381e+05 -nan +2.25985e+05 -nan +2.33855e+05 -nan +2.41998e+05 -nan +2.50426e+05 -nan +2.59146e+05 -nan +2.68170e+05 -nan +2.77509e+05 -nan +2.87173e+05 -nan +2.97173e+05 -nan +3.07521e+05 -nan +3.18230e+05 -nan +3.29312e+05 -nan +3.40779e+05 -nan +3.52646e+05 -nan +3.64927e+05 -nan +3.77635e+05 -nan +3.90785e+05 -nan +4.04393e+05 -nan +4.18475e+05 -nan +4.33048e+05 -nan +4.48128e+05 -nan +4.63733e+05 -nan +4.79882e+05 -nan +4.96593e+05 -nan +5.13886e+05 -nan +5.31781e+05 -nan +5.50299e+05 -nan +5.69462e+05 -nan +5.89292e+05 -nan +6.09813e+05 -nan +6.31049e+05 -nan +6.53024e+05 -nan +6.75764e+05 -nan +6.99296e+05 -nan +7.23648e+05 -nan +7.48848e+05 -nan +7.74925e+05 -nan +8.01910e+05 -nan +8.29835e+05 -nan +8.58732e+05 -nan +8.88636e+05 -nan +9.19581e+05 -nan +9.51604e+05 -nan +9.84741e+05 -nan +1.01903e+06 -nan +1.05452e+06 -nan +1.09124e+06 -nan +1.12924e+06 -nan +1.16856e+06 -nan +1.20926e+06 -nan +1.25137e+06 -nan +1.29494e+06 -nan +1.34004e+06 -nan +1.38670e+06 -nan +1.43499e+06 -nan +1.48496e+06 -nan +1.53667e+06 -nan +1.59018e+06 -nan +1.64556e+06 -nan +1.70286e+06 -nan +1.76216e+06 -nan +1.82353e+06 -nan +1.88703e+06 -nan +1.95274e+06 -nan +2.02074e+06 -nan +2.09111e+06 -nan +2.16393e+06 -nan +2.23928e+06 -nan +2.31726e+06 -nan +2.39795e+06 -nan +2.48146e+06 -nan +2.56787e+06 -nan +2.65729e+06 -nan +2.74982e+06 -nan +2.84558e+06 -nan +2.94467e+06 -nan +3.04722e+06 -nan +3.15333e+06 -nan +3.26314e+06 -nan +3.37677e+06 -nan +3.49436e+06 -nan +3.61604e+06 -nan +3.74196e+06 -nan +3.87227e+06 -nan +4.00712e+06 -nan +4.14666e+06 -nan +4.29105e+06 -nan +4.44048e+06 -nan +4.59511e+06 -nan +4.75513e+06 -nan +4.92072e+06 -nan +5.09207e+06 -nan +5.26939e+06 -nan +5.45289e+06 -nan +5.64278e+06 -nan +5.83927e+06 -nan +6.04262e+06 -nan +6.25304e+06 -nan +6.47079e+06 -nan +6.69612e+06 -nan +6.92930e+06 -nan +7.17060e+06 -nan +7.42030e+06 -nan +7.67870e+06 -nan +7.94609e+06 -nan +8.22280e+06 -nan +8.50914e+06 -nan +8.80546e+06 -nan +9.11209e+06 -nan +9.42940e+06 -nan +9.75776e+06 -nan +1.00976e+07 -nan +1.04492e+07 -nan +1.08131e+07 -nan +1.11896e+07 -nan +1.15793e+07 -nan +1.19825e+07 -nan +1.23997e+07 -nan +1.28315e+07 -nan +1.32784e+07 -nan +1.37408e+07 -nan +1.42193e+07 -nan +1.47144e+07 -nan +1.52268e+07 -nan +1.57571e+07 -nan +1.63058e+07 -nan +1.68736e+07 -nan +1.74612e+07 -nan +1.80692e+07 -nan +1.86985e+07 -nan +1.93496e+07 -nan +2.00234e+07 -nan +2.07207e+07 -nan +2.14422e+07 -nan +2.21889e+07 -nan +2.29616e+07 -nan +2.37612e+07 -nan +2.45886e+07 -nan +2.54449e+07 -nan +2.63310e+07 -nan +2.72479e+07 -nan +2.81967e+07 -nan +2.91786e+07 -nan +3.01947e+07 -nan +3.12462e+07 -nan +3.23343e+07 -nan +3.34603e+07 -nan +3.46255e+07 -nan +3.58312e+07 -nan +3.70790e+07 -nan +3.83702e+07 -nan +3.97063e+07 -nan +4.10890e+07 -nan +4.25199e+07 -nan +4.40006e+07 -nan +4.55328e+07 -nan +4.71184e+07 -nan +4.87592e+07 -nan +5.04571e+07 -nan +5.22142e+07 -nan +5.40325e+07 -nan +5.59140e+07 -nan +5.78611e+07 -nan +5.98760e+07 -nan +6.19611e+07 -nan +6.41188e+07 -nan +6.63516e+07 -nan +6.86621e+07 -nan +7.10532e+07 -nan +7.35274e+07 -nan +7.60879e+07 -nan +7.87375e+07 -nan +8.14794e+07 -nan +8.43167e+07 -nan +8.72529e+07 -nan +9.02913e+07 -nan +9.34355e+07 -nan +9.66892e+07 -nan diff --git a/sed/mehdipour2013/mehdipour2013_powlaw_coords.tab b/sed/mehdipour2013/mehdipour2013_powlaw_coords.tab index 69540db..37166e3 100644 --- a/sed/mehdipour2013/mehdipour2013_powlaw_coords.tab +++ b/sed/mehdipour2013/mehdipour2013_powlaw_coords.tab @@ -1,5 +1,6 @@ +12.00 -9 0.0004 3.2e10 -0.006 4,9e13 +0.006 4.9e13 .4 2.2e13 2 1.4e13 100 7.7e13 diff --git a/sed/mehdipour2013/mehdipour2013_samples.tab b/sed/mehdipour2013/mehdipour2013_samples.tab index e9895f4..87880ab 100644 --- a/sed/mehdipour2013/mehdipour2013_samples.tab +++ b/sed/mehdipour2013/mehdipour2013_samples.tab @@ -1,4 +1,6 @@ +0.0013 9e12 0.002 2e13 0.005 5e13 1.3 1.3e13 -240 8.2e13 \ No newline at end of file +240 8.2e13 +300 8e13les \ No newline at end of file diff --git a/src/sed.hpp b/src/sed.hpp index c6aeb51..ba5ed6e 100644 --- a/src/sed.hpp +++ b/src/sed.hpp @@ -35,6 +35,19 @@ struct sed_table { table1d table; }; +// To account for the four main powerlaws in a typical +// AGN SED. +struct powerlaw_bounds { + double ir_min; + double ir_max; + double uv_min; + double uv_max; + double xray_min; + double xray_max; + double gamma_min; + double gamma_max; +}; + class powerlaw { private: // f(x) = _normal*x^_power @@ -44,13 +57,13 @@ public: powerlaw(): _power(0), _normal(0) {} powerlaw(coord2d x0,coord2d x1): _power((log(x1.second)-log(x0.second))/(log(x1.first)-log(x0.first))), - _normal((log(x0.second)-(_power*log(x0.first)))) + _normal(exp(log(x0.second)-(_power*log(x0.first)))) {} - powerlaw(coord2d x0,double slope): - _power(slope), - _normal((log(x0.second)-(_power*log(x0.first)))) + powerlaw(coord2d x0,double power): + _power(power), + _normal(exp(log(x0.second)-(_power*log(x0.first)))) {} - double eval(double hnu) { return 0; } + double eval(double hnu) { return _normal*pow(hnu,_power); } }; class sed { @@ -60,7 +73,7 @@ public: sed_table histogram_table(int n); // Argument is photon energy in eV - virtual double table(double hnu) {}; + virtual double eval(double hnu) {}; sed() {}; }; @@ -72,6 +85,7 @@ private: powerlaw _uv_powerlaw; powerlaw _xray_powerlaw; powerlaw _gamma_powerlaw; + powerlaw_bounds _bounds; // These parameters might still be useful for rolling off various quantities, but aren't used in the strict-spline case. @@ -84,14 +98,15 @@ private: double _xray_coefficient; public: - double table(double hnu); + double eval(double hnu); sed_powerlaw_spline(agn::sed_table& samples, agn::sed_table& powerlaw_coords); + powerlaw * getpowerlaw(double hnu); }; class sed_pow_law : public sed { public: - double table(double hnu); + double eval(double hnu); // Argument is photon energy in eV double eval_uv(double hnu); double eval_xray(double hnu); @@ -133,7 +148,7 @@ public: }; // Returns coord in eV for given relative coord. -double hnu_at(int i,int n); +double logspace_hnu_at(int i,int n); // Takes an SED table as input and returns a string with format: // '\t\n' for each energy-flux pair @@ -168,37 +183,79 @@ agn::sed_powerlaw_spline::sed_powerlaw_spline( // powerlaws are evaluated across four regions of the sed, first // we construct the powerlaws, here, and locate them iterator1d table_it = powerlaw_coords.table.begin(); - double ir_power = 3; + double ir_power = (*table_it).first; + double gamma_power = (*table_it).second; + std::cout << ir_power << ", " << gamma_power; + table_it++; coord2d ir_high_point = *table_it; table_it++; coord2d uv_low_point = *table_it; table_it++; coord2d uv_high_point = *table_it; table_it++; coord2d xray_low_point = *table_it; table_it++; coord2d xray_high_point = *table_it; table_it++; coord2d gamma_low_point = *table_it; - double gamma_power = -2; _ir_powerlaw = powerlaw(ir_high_point,ir_power); _uv_powerlaw = powerlaw(uv_low_point,uv_high_point); _xray_powerlaw = powerlaw(xray_low_point,xray_high_point); _gamma_powerlaw = powerlaw(gamma_low_point,gamma_power); - double ir_lowerbound = agn::CLOUDY_MIN_EV; - double ir_upperbound = ir_high_point.first; - double uv_lowerbound = uv_low_point.first; - double uv_upperbound = uv_high_point.first; - double xray_lowerbound = xray_low_point.first; - double xray_upperbound = xray_high_point.first; - double gamma_lowerbound = gamma_low_point.first; - double gamma_upperbound = agn::CLOUDY_MAX_EV; + _bounds.ir_min = agn::CLOUDY_MIN_EV; + _bounds.ir_max = ir_high_point.first; + _bounds.uv_min = uv_low_point.first; + _bounds.uv_max = uv_high_point.first; + _bounds.xray_min = xray_low_point.first; + _bounds.xray_max = xray_high_point.first; + _bounds.gamma_min = gamma_low_point.first; + _bounds.gamma_max = agn::CLOUDY_MAX_EV; + + if(agn::debug) { + std::cout << "[Constructor] Powerlaw Boundaries: \n"; + std::cout << _bounds.ir_min << std::endl; + std::cout << _bounds.ir_max << std::endl; + std::cout << _bounds.uv_min << std::endl; + std::cout << _bounds.uv_max << std::endl; + std::cout << _bounds.xray_min << std::endl; + std::cout << _bounds.xray_max << std::endl; + std::cout << _bounds.gamma_min << std::endl; + std::cout << _bounds.gamma_max << std::endl; + } // here we inject the powerlaws into the samples - int segments=10; + int segments=100; + double hnu = 0; + double value = 0; for (int i=0; i<=segments; i++) { - double hnu = - ir_lowerbound + - (i/segments)*(ir_upperbound-ir_lowerbound); - double value = _ir_powerlaw.eval(hnu); + hnu = + _bounds.ir_min + + (i/(double)segments)*(_bounds.ir_max - _bounds.ir_min); + value = _ir_powerlaw.eval(hnu); coord2d point = coord2d(hnu,value); - samples.table.insert(point); + samples.table.insert(samples.table.end(),point); + } + + for (int i=0; i<=segments; i++) { + hnu = + _bounds.uv_min + + (i/(double)segments)*(_bounds.uv_max - _bounds.uv_min); + value = _uv_powerlaw.eval(hnu); + coord2d point = coord2d(hnu,value); + samples.table.insert(samples.table.end(),point); + } + + for (int i=0; i<=segments; i++) { + hnu = + _bounds.xray_min + + (i/(double)segments)*(_bounds.xray_max - _bounds.xray_min); + value = _xray_powerlaw.eval(hnu); + coord2d point = coord2d(hnu,value); + samples.table.insert(samples.table.end(),point); + } + for (int i=0; i<=segments; i++) { + hnu = + _bounds.gamma_min + + (i/(double)segments)*(_bounds.gamma_max - _bounds.gamma_min); + value = _gamma_powerlaw.eval(hnu); + coord2d point = coord2d(hnu,value); + samples.table.insert(samples.table.end(),point); } if(agn::debug) { @@ -249,30 +306,44 @@ agn::sed_pow_law::sed_pow_law ( // writes log-space histogram with n data agn::sed_table agn::sed::histogram_table(int n){ - agn::sed_table output; + agn::sed_table table; double max=0,min=1,hnu; for(int i=0; itable(hnu); - if (output.table[hnu] > max) max = output.table[hnu]; - if (output.table[hnu] < min) min = output.table[hnu]; + // evenly space coordinates in log space and save values + hnu = logspace_hnu_at(i,n); + table.table[hnu] = this->eval(hnu); + // Just collects min and max + if (table.table[hnu] > max) max = table.table[hnu]; + if (table.table[hnu] < min) min = table.table[hnu]; } - // Add a final point at 100 KeV - hnu = 1e5; - output.table[hnu] = this->table(hnu); - return output; + return table; } // sed_powerlaw_spline evaluation -double agn::sed_powerlaw_spline::table(double hnu) { +double agn::sed_powerlaw_spline::eval(double hnu) { double magnitude=0.0; - magnitude += this->_output_model[hnu]; + agn::powerlaw * here = this->getpowerlaw(hnu); + if (here == NULL) + magnitude += this->_output_model[hnu]; + else + magnitude += here->eval(hnu); if (magnitude < agn::CONT_MIN_VAL) return agn::CONT_MIN_VAL; return magnitude; } +agn::powerlaw * agn::sed_powerlaw_spline::getpowerlaw(double hnu) { + if (hnu <= _bounds.gamma_max && hnu >= _bounds.gamma_min ) + return &_gamma_powerlaw; + if (hnu <= _bounds.uv_max && hnu >= _bounds.uv_min ) + return &_uv_powerlaw; + if (hnu <= _bounds.xray_max && hnu >= _bounds.xray_min ) + return &_xray_powerlaw; + if (hnu <= _bounds.ir_max && hnu >= _bounds.ir_min ) + return &_ir_powerlaw; + return NULL; +} // sed_pow_law evaluations -double agn::sed_pow_law::table(double hnu) { +double agn::sed_pow_law::eval(double hnu) { double magnitude=0.0; magnitude += this->eval_uv(hnu); magnitude += this->eval_xray(hnu); @@ -315,14 +386,31 @@ double agn::sed_pow_law::SED_at_2KeV() { agn::sed_table agn::read_sed_table(std::ifstream& table_file) { sed_table resultant; std::string scratch; - int current_line=0; double hnu; std::getline(table_file,scratch); if(!isdigit(scratch[0])) { resultant.header = scratch; - current_line++; } + else + table_file.seekg(0); while(!table_file.eof()) { + char next; + next = table_file.peek(); + if (next == '\n'){ + table_file.get(); + next = table_file.peek(); + } + 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]; } @@ -425,10 +513,10 @@ std::string agn::cloudy_interpolate_str(agn::sed_table table) { } -double agn::hnu_at(int i,int n) { - double relative_coord=(double)(i)/n; - double x_coord = relative_coord*CONT_WIDTH_LOGX + CONT_MIN_LOGX; - return pow(10,x_coord); +double agn::logspace_hnu_at(int i,int n) { + double relative_coord_logspace=(double)(i)/n; + double abs_coord_logspace = relative_coord_logspace*CONT_WIDTH_LOGX + CONT_MIN_LOGX; + return pow(10,abs_coord_logspace); } diff --git a/src/table_powerlaw_spline_sed.cpp b/src/table_powerlaw_spline_sed.cpp index 7178faf..9f8381f 100644 --- a/src/table_powerlaw_spline_sed.cpp +++ b/src/table_powerlaw_spline_sed.cpp @@ -28,7 +28,7 @@ int main(int argc, char const *argv[]) std::ofstream::out ); std::ifstream powerlaw_table( - sample_filename, + powerlaw_filename, std::ofstream::out ); std::ofstream output_table( @@ -45,11 +45,15 @@ int main(int argc, char const *argv[]) // Read in sampling table and construct a spline model. samples = agn::read_sed_table(sample_table); - powerlaw_coords = agn::read_sed_table(powerlaw_table); if(agn::debug) debug_file << "Read samples:\n" << format_sed_table(samples); + powerlaw_coords = agn::read_sed_table(powerlaw_table); + + if(agn::debug) debug_file + << "Read power coords:\n" + << format_sed_table(powerlaw_coords); agn::sed_powerlaw_spline agnsource(samples,powerlaw_coords); @@ -57,7 +61,7 @@ int main(int argc, char const *argv[]) if(agn::verbose) std::cout - << "Evaluating relative spectral intensity for " + << "Evaluating spectral intensity for " << n << " photon energy bins.\n";