@@ -55,6 +55,24 @@ bool MFDFA::computeFlucVec(){
55
55
return execStop;
56
56
}
57
57
58
+ void MFDFA::computeMassExponents ()
59
+ {
60
+ tau = new double [Nq];
61
+ for (int i = 0 ; i < Nq; i++)
62
+ tau[i] = Hq[i] * qRange[i] - 1.0 ;
63
+ }
64
+
65
+ void MFDFA::computeSpectrum ()
66
+ {
67
+ computeMassExponents ();
68
+ alpha = new double [Nq-1 ];
69
+ spectrum = new double [Nq-1 ];
70
+ for (int i = 0 ; i < Nq-1 ; i++)
71
+ alpha[i] = (tau[i+1 ] - tau[i]) / (qRange[1 ] - qRange[0 ]);
72
+ for (int i = 0 ; i < Nq-1 ; i++)
73
+ spectrum[i] = qRange[i] * alpha[i] - tau[i];
74
+ }
75
+
58
76
std::string MFDFA::outFileStr (){
59
77
return " /" +MFDFAfnStart+" _" +std::to_string (minWin)+" _" +std::to_string (maxWin)+" _q" +std::to_string (static_cast <int >(qRange[0 ]))+" _" +
60
78
std::to_string (static_cast <int >(qRange[Nq-1 ]))+" _" +fileName.substr (fileName.find_last_of (" /" )+1 );
@@ -93,6 +111,36 @@ void MFDFA::qsaveFile(std::string pathTot){
93
111
fclose (f);
94
112
}
95
113
114
+ std::string MFDFA::tauOutFileStr (){
115
+ return " /tau_q" +std::to_string (static_cast <int >(qRange[0 ]))+" _" +std::to_string (static_cast <int >(qRange[Nq-1 ]))+
116
+ " _" +fileName.substr (fileName.find_last_of (" /" )+1 );
117
+ }
118
+
119
+ void MFDFA::tauSaveFile (std::string pathTot){
120
+ FileOps fo = FileOps ();
121
+ FILE *f;
122
+ f = fo.openFile (pathTot+tauOutFileStr (), " w" );
123
+ for (int i = 0 ; i < Nq; i++){
124
+ fprintf (f, " %lf %lf\n " , qRange[i], tau[i]);
125
+ }
126
+ fclose (f);
127
+ }
128
+
129
+ std::string MFDFA::spectrumOutFileStr (){
130
+ return " /spectrum_q" +std::to_string (static_cast <int >(qRange[0 ]))+" _" +std::to_string (static_cast <int >(qRange[Nq-1 ]))+
131
+ " _" +fileName.substr (fileName.find_last_of (" /" )+1 );
132
+ }
133
+
134
+ void MFDFA::spectrumSaveFile (std::string pathTot){
135
+ FileOps fo = FileOps ();
136
+ FILE *f;
137
+ f = fo.openFile (pathTot+spectrumOutFileStr (), " w" );
138
+ for (int i = 0 ; i < Nq-1 ; i++){
139
+ fprintf (f, " %lf %lf\n " , alpha[i], spectrum[i]);
140
+ }
141
+ fclose (f);
142
+ }
143
+
96
144
void MFDFA::plot (BasePlot *plt){
97
145
QVector<double > yh (Nq), xq (Nq);
98
146
for (int i = 0 ; i < Nq; i++){
@@ -116,3 +164,53 @@ void MFDFA::plot(BasePlot *plt){
116
164
plt->legend ->setVisible (true );
117
165
plt->axisRect ()->insetLayout ()->setInsetAlignment (0 , Qt::AlignTop|Qt::AlignLeft);
118
166
}
167
+
168
+ void MFDFA::plotMassExponents (BasePlot *plt)
169
+ {
170
+ QVector<double > yt (Nq), xq (Nq);
171
+ for (int i = 0 ; i < Nq; i++){
172
+ xq[i] = qRange[i];
173
+ yt[i] = tau[i];
174
+ }
175
+ plt->addGraph ();
176
+ plt->xAxis ->setLabel (" q" );
177
+ plt->yAxis ->setLabel (" tau(q)" );
178
+ plt->graph (0 )->setData (xq, yt);
179
+ plt->graph (0 )->setLineStyle (QCPGraph::lsLine);
180
+ plt->graph (0 )->setScatterStyle (QCPScatterStyle (QCPScatterStyle::ssDisc, Qt::red, 10 ));
181
+ QString fn = QString::fromStdString (fileName).split (" /" ).last ();
182
+ fn.truncate (fn.lastIndexOf (" ." ));
183
+ plt->graph (0 )->setName (fn);
184
+ plt->graph (0 )->rescaleAxes ();
185
+ QPen pen;
186
+ pen.setWidth (2 );
187
+ pen.setColor (Qt::red);
188
+ plt->graph (0 )->setPen (pen);
189
+ plt->legend ->setVisible (true );
190
+ plt->axisRect ()->insetLayout ()->setInsetAlignment (0 , Qt::AlignTop|Qt::AlignLeft);
191
+ }
192
+
193
+ void MFDFA::plotSpectrum (BasePlot *plt)
194
+ {
195
+ QVector<double > a (Nq-1 ), f (Nq-1 );
196
+ for (int i = 0 ; i < Nq-1 ; i++){
197
+ a[i] = alpha[i];
198
+ f[i] = spectrum[i];
199
+ }
200
+ plt->addGraph ();
201
+ plt->xAxis ->setLabel (" alpha" );
202
+ plt->yAxis ->setLabel (" f(alpha)" );
203
+ plt->graph (0 )->setData (a, f);
204
+ plt->graph (0 )->setLineStyle (QCPGraph::lsLine);
205
+ plt->graph (0 )->setScatterStyle (QCPScatterStyle (QCPScatterStyle::ssDisc, Qt::red, 10 ));
206
+ QString fn = QString::fromStdString (fileName).split (" /" ).last ();
207
+ fn.truncate (fn.lastIndexOf (" ." ));
208
+ plt->graph (0 )->setName (fn);
209
+ plt->graph (0 )->rescaleAxes ();
210
+ QPen pen;
211
+ pen.setWidth (2 );
212
+ pen.setColor (Qt::red);
213
+ plt->graph (0 )->setPen (pen);
214
+ plt->legend ->setVisible (true );
215
+ plt->axisRect ()->insetLayout ()->setInsetAlignment (0 , Qt::AlignTop|Qt::AlignLeft);
216
+ }
0 commit comments