15 using namespace gplib;
27 "$Id: generatemtts.cpp 1852 2010-05-20 09:14:53Z mmoorkamp $";
33 <<
"This is generatemtts: Generate a synthetic MT time series."
35 cout <<
" You will have to input the name of a time series with two magnetic time series\n";
36 cout <<
" and a model file\n";
37 cout <<
" Output will have the same name as the modelfile with _ts.asc appended\n ";
38 cout <<
" and will contain the magnetic field and an electric field obeying the impedance \n ";
39 cout <<
" relationship calculate from the 1D model. \n ";
40 cout <<
" This is Version: " <<
version << endl << endl;
42 std::string intsname = AskFilename(
43 "File with magnetic field times series: ");
49 const size_t nfreq = nsamples / 2 + 1;
50 cvec HxSpec(nfreq), HySpec(nfreq), ExSpec(nfreq), EySpec(nfreq);
69 string modelfilename = AskFilename(
"Model filename: ");
73 double samplerate = 1.0;
74 const double eps = 1e-5;
75 const size_t samplelength = nsamples;
76 const double freqstep = samplerate / samplelength;
78 frequency.push_back(eps);
79 for (
size_t i = 1; i < samplelength / 2 +1; ++i)
81 frequency.push_back(freqstep * i);
85 for (
size_t i = 0; i < nfreq; ++i)
87 ExSpec(i) = Synthetic.
at(i).
GetZxy() * HySpec(i);
88 EySpec(i) = Synthetic.
at(i).
GetZyx() * HxSpec(i);
std::vector< double > & GetData()
Access for data vector, for ease of use and efficiency we return a reference.
TimeSeries & GetData()
return a reference to the actual object stored in the pointer
TimeSeriesComponent & GetEx()
const MTTensor & at(const unsigned int i) const
direct acces to a tensor at a given index
void SubMean(InputIterator begin, InputIterator end, typename std::iterator_traits< InputIterator >::value_type mean)
Substract the mean from each element in the container, mean is passed as a parameter.
This functor returns the weighting factor for the Hamming window, given the relative position relpos ...
std::complex< double > GetZyx() const
TimeSeriesComponent & GetHy()
std::complex< double > GetZxy() const
void ReadModel(std::string filename)
Read the model from a file.
virtual void CalcSynthetic()
Calculate the synthetic data given the previously set parameters.
The class CTsSpectrum is used to calculate spectra from (real) time series data.
void WriteAsBirrp(std::string filename_base)
Write data to file in ascii format for birrp processing.
TimeSeriesData stores a pointer to the different components of magnetotelluric data and provides func...
Calculate synthetic MT data for a 1D model using Cagniard's algorithm.
TimeSeriesComponent & GetEy()
void SetFrequencies(const trealdata &freqs)
Set the frequencies of the tensor elements, invalidates the previously stored impedance data...
TimeSeriesComponent & GetHx()
Access function for Hx, returns reference for efficiency.