#include #include #include #include #include #include using namespace std; //fftw fourier transform library #ifdef FFTW_AVAILABLE #include #endif #include "rts/material.h" //#include "options.h" #include namespace po = boost::program_options; typedef double ptype; typedef complex pcomplex; rts::material M; #define PI 3.14159 int main(int argc, char* argv[]) { po::options_description desc("Allowed options"); desc.add_options() ("help,h", "Display this help message.") ("input-file,i", po::value(), "Input file containing material information.") ("input-format,f", po::value()->default_value("wavenumber,n,k"), "Format string identifying the order of material properties in the input file. Options include: microns, wavenumber, n (real RI), k (imaginary RI), A (absorbance), Xp (real Chi), Xpp (imaginary Chi).\n\nThe default [microns,n,k] will load a material file with columns representing the wavelength in microns, followed by the real and imaginary parts of the refractive index.") ("output-file,o", po::value()->default_value("out.txt"), "Output file containing the processed material information.") ("output-format,t", po::value()->default_value("wavenumber,n,k"), "Format string for the output file (similar to --input-format).") ("scaling,s", po::value()->default_value(1.0), "Scaling value for the absorbance parameter. This value gives the thickness (in microns) of the measured material.") ("n0,n", po::value()->default_value(1.48), "Average effective refractive index. This is required when computing the real refractive index from the absorption.") ("padding,p", po::value()->default_value(2), "Padding factor used to remove edge artifacts in the Kramers-Kronig computation for computing the real RI from absorption. The default value of p=2 is sufficient in most cases.") ("resolution,r", po::value(), "Resolution of the spectrum. The default value is based on the number of spectral samples provided in the input file.") ("reverse,v", "reverse the order of the output file"); po::positional_options_description pos; pos.add("input-file", 1); pos.add("output-file", 1); po::variables_map vm; po::store(po::command_line_parser(argc, argv).options(desc).positional(pos).run(), vm); po::notify(vm); if(vm.count("help")) { cout<(), vm["input-format"].as(), 1.0 / vm["scaling"].as()); } else { cout<<"No input file was provided."<(); //compute the real refractive index rts::material N = M.computeN(vm["n0"].as(), R, vm["padding"].as()); //output the file using the standard format bool reverse_order = false; if(vm.count("reverse")) reverse_order = true; N.save(vm["output-file"].as(), vm["output-format"].as(), reverse_order); return 0; }