- Author
- Paul Tiede
- Date
- April, 2018
Themis allows a wide variety of models to be compared to WHT data. This examples show how the query the semi-analytic shearing spot model, which is an explictly time dependent model that captures some aspects of variability in Sgr A*. This script explictly generates a series of images i.e. a movie using the sed of 2010 data run. The output of this script is given by shearing_spot_movie_frame_i.d where i runs from 0 to 9 and is the frames of the movie in pmap format and each frame may be plotted with the python script vrt2_image.py. For example the fifth frame may be plotted using the commands:
$ cd ../../analysis
$ python plot_vrt2_images.py shearing_spot_movie_frame_4.d
The resulting 10 frame movie is shown below.
Short movie of shearing spot model.
MPI_Init(&argc, &argv);
std::vector<double> observing_times;
double tstart = 544276800;
double tend = 544276800 + 3600;
int number_of_images = 10;
double dt = (tend-tstart)/(number_of_images-1);
for (int i = 0; i < 4; i++)
observing_times.push_back(tstart+i*dt);
std::string sed_image_fitted = "../../src/VRT2/DataFiles/2010_combined_fit_parameters.d";
Themis::model_shearing_spot movie(tstart, observing_times);
std::vector<double> parameters;
parameters.push_back(0.2);
parameters.push_back(std::cos(M_PI/3.0));
parameters.push_back(5.82161e7);
parameters.push_back(0.5);
parameters.push_back(-2000);
parameters.push_back(7.0);
parameters.push_back(0.0);
parameters.push_back(0.98);
parameters.push_back(0.99);
parameters.push_back(0.0);
double Nrays = 100;
movie.set_image_resolution(Nrays);
movie.set_screen_size(12);
movie.generate_model(parameters);
std::string basename = "shearing_spot_frame";
for ( size_t i = 0; i < observing_times.size(); ++i)
{
std::vector< std::vector<double>> I, alpha, beta;
movie.get_movie_frame(observing_times[i], alpha, beta, I);
double rad2M = VRT2::VRT2_Constants::D_SgrA_cm/VRT2::VRT2_Constants::M_SgrA_cm;
std::stringstream movie_name;
movie_name << basename << i << ".d";
std::ofstream movout(movie_name.str().c_str());
movout << "Nx:"
<< std::setw(15) << rad2M*alpha[0][0]
<< std::setw(15) << rad2M*alpha[alpha.size()-1].back()
<< std::setw(15) << alpha.size() << std::endl;
movout << "Ny:"
<< std::setw(15) << rad2M*beta[0][0]
<< std::setw(15) << rad2M*beta[alpha.size()-1].back()
<< std::setw(15) << beta.size() << std::endl;
movout << std::setw(5) << "i"
<< std::setw(5) << "j"
<< std::setw(15) << "I (Jy/sr)"
<< std::endl;
for (size_t j=0; j<alpha[0].size(); ++j)
for (size_t i=0; i<alpha.size(); ++i)
movout << std::setw(5) << i
<< std::setw(5) << j
<< std::setw(15) << I[i][j]
<< std::endl;
movout.close();
}
MPI_Finalize();
MPI_Init(&argc, &argv);
std::vector<double> observing_times;
double tstart = 0;
double tend = 1.2*3600;
int nframes = 12;
double dt = (tend-tstart)/(nframes);
for (int i = 0; i < nframes; i++)
observing_times.push_back(tstart+i*dt);
std::string sed_image_fitted = "../../src/VRT2/DataFiles/2010_combined_fit_parameters.d";
std::vector<double> parameters;
parameters.push_back(0.2);
parameters.push_back(std::cos(M_PI/3.0));
parameters.push_back(1e8);
parameters.push_back(0.5);
parameters.push_back(0);
parameters.push_back(6.3);
parameters.push_back(0.0);
parameters.push_back(0.95);
parameters.push_back(0.99);
parameters.push_back(0.0);
double Nrays = 64;
movie.set_image_resolution(Nrays);
movie.set_screen_size(10);
movie.add_background_riaf();
movie.generate_model(parameters);
std::string basename = "shearing_spot_riaf_frame_";
for ( size_t l = 0; l < observing_times.size(); ++l)
{
std::vector< std::vector<double>> I, alpha, beta;
movie.get_movie_frame(observing_times[l], alpha, beta, I);
std::stringstream movie_name;
movie_name << basename << l << ".d";
std::ofstream movout(movie_name.str().c_str());
movout << "Nx:"
<< std::setw(15) << alpha[0][0]
<< std::setw(15) << alpha[alpha.size()-1].back()
<< std::setw(15) << alpha.size() << std::endl;
movout << "Ny:"
<< std::setw(15) << beta[0][0]
<< std::setw(15) << beta[beta.size()-1].back()
<< std::setw(15) << beta.size() << std::endl;
movout << std::setw(5) << "i"
<< std::setw(5) << "j"
<< std::setw(15) << "I (Jy/sr)"
<< std::endl;
for (size_t m=0; m< alpha[0].size(); ++m)
for (size_t n=0; n <alpha.size(); ++n)
movout << std::setw(5) << m
<< std::setw(5) << n
<< std::setw(15) << I[m][n]
<< std::endl;
movout.close();
}
MPI_Finalize();