Maintenance will be performed on git.ligo.org and chat.ligo.org on the 25th April 2019 between 9-10pm CDT, towards the end of the maintenance window there will be a short (5-10 minute) downtime.

Commit 3e85e9d3 authored by Tyson Littenberg's avatar Tyson Littenberg

Merge branch 'odds-n-ends' into 'master'

A lot:

See merge request !55
parents f0a48c6a bca1d22d
Pipeline #46632 passed with stages
in 11 minutes and 20 seconds
This diff is collapsed.
......@@ -79,8 +79,7 @@ struct BayesLineParams
dataParams *data;
splineParams *spline;
splineParams *spline_x;
lorentzianParams *lines_x;
lorentzianParams *lines_full;
lorentzianParams *lines_x;
BayesLinePriors *priors;
double *Snf;
......
......@@ -380,6 +380,11 @@ int main(int argc, char *argv[])
model[ic]->Snf[ifo][i] = model[0]->Snf[ifo][i];
model[ic]->SnS[ifo][i] = model[0]->SnS[ifo][i];
model[ic]->invSnf[ifo][i] = model[0]->invSnf[ifo][i];
}
for(i=0; i< bayesline[chain->index[0]][ifo]->data->ncut; i++)
{
bayesline[chain->index[ic]][ifo]->priors->lower[i] = bayesline[chain->index[0]][ifo]->priors->lower[i];
bayesline[chain->index[ic]][ifo]->priors->upper[i] = bayesline[chain->index[0]][ifo]->priors->upper[i];
}
}
}
......@@ -527,8 +532,8 @@ int main(int argc, char *argv[])
int CP = data->clusterPriorFlag;
data->clusterPriorFlag = 0;
chain->count = M;
//chain->NC = NC/5;
//if(chain->NC < 1)chain->NC=1;
chain->NC = NC/5;
if(chain->NC < 1)chain->NC=1;
//Initialize proposal ratios for glitch cleaning phase
chain->modelRate = 0.0; //even chance for each channel
......@@ -557,12 +562,9 @@ int main(int argc, char *argv[])
printf("characterizing PSD+glitch model...\n\n");
//TODO disable checkpointing and adaptation during cleaning phase
//int saveCheckpointFlag = data->checkpointFlag;
int saveAdaptationFlag = data->adaptTemperatureFlag;
//data->checkpointFlag = 0;
data->adaptTemperatureFlag = 0;
RJMCMC(data, model, bayesline, chain, prior, &cleanLogZ, &cleanVarZ);
//data->checkpointFlag = saveCheckpointFlag;
data->adaptTemperatureFlag = saveAdaptationFlag;
/******************************************************************************/
......@@ -673,18 +675,6 @@ int main(int argc, char *argv[])
for(ifo=0; ifo<NI; ifo++)
{
for(i=0; i<data->N/2; i++) psd[ifo][i] = model[chain->index[0]]->Snf[ifo][i];
//Reset priors on PSD
imin = (int)(data->Tobs*data->fmin);
for(i=0; i<(int)(data->Tobs*(data->fmax-data->fmin))+1; i++)
{
//bayesline[ifo]->priors->invsigma[i] = 1./(psd[ifo][i+(int)(Tobs*fmin)]*1.0);
bayesline[chain->index[0]][ifo]->priors->sigma[i] = psd[ifo][i+imin];
bayesline[chain->index[0]][ifo]->priors->mean[i] = psd[ifo][i+imin];
bayesline[chain->index[0]][ifo]->priors->lower[i] = psd[ifo][i+imin]/10.;
bayesline[chain->index[0]][ifo]->priors->upper[i] = psd[ifo][i+imin]*2.;
}
for(ic=1; ic<chain->NC; ic++)
{
......
......@@ -710,7 +710,6 @@ void write_gnuplot_psd_animation(struct Data *data, char modelname[], int frame)
fprintf(framefile,"set logscale\n");
fprintf(framefile,"set tics scale 2 nomirror\n");
fprintf(framefile,"set border 3\n");
fprintf(framefile,"unset key\n");
fprintf(framefile,"\n");
fprintf(framefile,"psdmin = 1e-48\n");
fprintf(framefile,"psdmax = 1e-38\n");
......@@ -734,15 +733,15 @@ void write_gnuplot_psd_animation(struct Data *data, char modelname[], int frame)
fprintf(framefile," set format \"10^{%%T}\"\n");
fprintf(framefile," set xlabel 'f'\n");
fprintf(framefile," set ylabel '|h|^2'\n");
fprintf(framefile," plot [*:*] [psdmin:psdmax] '%s_psd_%s_'.N.'.dat' u 1:2 w l lc 'gray', '' u 1:($3+$4) w l lc 'black' lw 2\n", modelname,ifos[n]);
fprintf(framefile," plot [*:*] [psdmin:psdmax] '%s_psd_%s_'.N.'.dat' u 1:2 w l lc 'gray' notitle, '' u 1:($3+$4) w l lc 'black' lw 2 notitle\n", modelname,ifos[n]);
fprintf(framefile,"\n");
fprintf(framefile," unset logscale\n");
fprintf(framefile," set format '%%g'\n");
fprintf(framefile," set xlabel 't'\n");
fprintf(framefile," set ylabel 'h'\n");
fprintf(framefile," plot [tmin:tmax] [hmin:hmax] '%s_data_%s_'.N.'.dat' w l lc 'gray'",modelname,ifos[n]);
if(data->glitchFlag) fprintf(framefile,", '%s_glitch_%s_'.N.'.dat' w l lc rgb '#a6611a' lw 2",modelname,ifos[n]);
if(data->signalFlag) fprintf(framefile,", '%s_wave_%s_'.N.'.dat' w l lc rgb '#7b3294' lw 2",modelname,ifos[n]);
fprintf(framefile," plot [tmin:tmax] [hmin:hmax] '%s_data_%s_'.N.'.dat' w l lc 'gray' notitle",modelname,ifos[n]);
if(data->glitchFlag) fprintf(framefile,", '%s_glitch_%s_'.N.'.dat' w l lc rgb '#a6611a' lw 2 title 'glitch'",modelname,ifos[n]);
if(data->signalFlag) fprintf(framefile,", '%s_wave_%s_'.N.'.dat' w l lc rgb '#7b3294' lw 2 title 'signal'",modelname,ifos[n]);
fprintf(framefile,"\n");
fprintf(framefile,"\n");
}
......@@ -751,7 +750,7 @@ void write_gnuplot_psd_animation(struct Data *data, char modelname[], int frame)
fprintf(framefile," unset multiplot\n");
fprintf(framefile,"}\n");
fprintf(framefile,"\n");
fprintf(framefile,"CMD='ffmpeg -r 4 -f image2 -s '.xsize*rescale.'x'.rescale*nifo*ysize.' -start_number 0 -i animation/bayeswave%%03d.png -vframes '.nmax.' -vcodec libx264 -crf 25 -pix_fmt yuv420p %s'\n",filename);
fprintf(framefile,"CMD='ffmpeg -r 8 -f image2 -s '.xsize*rescale.'x'.rescale*nifo*ysize.' -start_number 0 -i animation/bayeswave%%03d.png -vframes '.nmax.' -vcodec libx264 -crf 25 -pix_fmt yuv420p %s'\n",filename);
fprintf(framefile,"\n");
fprintf(framefile,"system(CMD)\n");
fprintf(framefile,"\n");
......@@ -1648,11 +1647,9 @@ void parse_command_line(struct Data *data, struct Chain *chain, struct Prior *pr
{
fprintf(stdout,"\n");
fprintf(stdout,"************************ WARNING ************************\n");
fprintf(stdout,"BayesLine requires the cleaning phase \n");
fprintf(stdout,"Ignoring --noClean argument \n");
fprintf(stdout,"If you really want to skip that step remove --bayesLine \n");
fprintf(stdout,"Assuming clean data outside of the analysis window \n");
fprintf(stdout,"For reliable results remove --noClean argument \n");
fprintf(stdout,"*********************************************************\n");
data->cleanModelFlag = 1;
}
//if doing a short run disable spline thermodynamic integration
......@@ -1662,7 +1659,7 @@ void parse_command_line(struct Data *data, struct Chain *chain, struct Prior *pr
fprintf(stdout,"************************ WARNING ************************\n");
fprintf(stdout,"Too few iterations for spline integration (%i)\n",chain->count);
fprintf(stdout,"Reverting to trapezoid integration\n");
fprintf(stdout,"Requst --Niter > 1000000 for spline integration\n");
fprintf(stdout,"Request --Niter > 1000000 for spline integration\n");
fprintf(stdout,"*********************************************************\n");
data->splineEvidenceFlag = 0;
}
......
......@@ -892,7 +892,6 @@ void RJMCMC(struct Data *data, struct Model **model, struct BayesLineParams ***b
int N = data->N;
int NI = data->NI;
int M = chain->count;
if(data->cleanFlag) M/=5;
int NC = chain->NC;
int i, ic, ifo, n;
......@@ -1146,22 +1145,6 @@ void RJMCMC(struct Data *data, struct Model **model, struct BayesLineParams ***b
recompute_residual(data, model, chain);
if(burnFlag==0 && chain->mc%1000==0 && data->signalFlag) TFprop_signal(data, prior->range, tf, model[chain->index[0]]->projection);
//During cleaning phase track max and min BL PSDs to set up priors for model selection run
if(data->bayesLineFlag && data->cleanFlag )
{
ic = chain->index[0];
for(ifo=0; ifo<NI; ifo++)
{
for(i=0; i< bayesline[ic][ifo]->data->ncut; i++)
{
if(bayesline[ic][ifo]->Snf[i] > bayesline[ic][ifo]->priors->upper[i])
bayesline[ic][ifo]->priors->upper[i] = bayesline[ic][ifo]->Snf[i]*10.;
else if(bayesline[ic][ifo]->Snf[i] < bayesline[ic][ifo]->priors->lower[i])
bayesline[ic][ifo]->priors->lower[i] = bayesline[ic][ifo]->Snf[i]/10.;
}
}
}
//Parallel tempering
if(NC>1 && chain->mc>1)
{
......@@ -1456,7 +1439,6 @@ void EvolveBayesLineParameters(struct Data *data, struct Model **model, struct B
struct BayesLineParams **bl_x = bayesline[chain->index[ic]];
int priorFlag = 1;
if(data->cleanFlag) priorFlag = 0;
//update PSD for each interferometer
for(ifo=0; ifo<NI; ifo++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment