Commit 19fed0e9 authored by Tyson Littenberg's avatar Tyson Littenberg
Browse files

several tweaks trying to deal with held jobs on CIT



git-svn-id: https://svn.ligo.caltech.edu/svn/bayeswave/trunk@665 c56465c9-8126-4a4f-9d7d-ac845eff4865
parent eb31cb8f
......@@ -511,7 +511,14 @@ int main(int argc, char *argv[])
double cleanLogZ, cleanVarZ;
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;
/******************************************************************************/
/* */
......
......@@ -985,18 +985,43 @@ void print_chain_files(struct Data *data, struct Chain *chain, struct Model **mo
if(data->verboseFlag)fflush(chain->intChainFile[ic]);
}
void flush_chain_files(struct Data *data, struct Chain *chain, int ic)
{
int ifo;
int NI = data->NI;
fflush(chain->intChainFile[ic]);
//print signal model parameters
if(data->signalFlag) fflush(chain->intWaveChainFile[ic]);
//print glitch model parameters
if(data->glitchFlag) for(ifo=0; ifo<NI; ifo++) fflush(chain->intGlitchChainFile[ifo][ic]);
//print PSD parameters
if(data->bayesLineFlag)
{
for(ifo=0; ifo<NI; ifo++)
{
fflush(chain->lineChainFile[ic][ifo]);
fflush(chain->splineChainFile[ic][ifo]);
}
}
}
void print_model(FILE *fptr, struct Data *data, struct Chain *chain, struct Model *model)
{
int ifo;
int NI = data->NI;
fprintf(fptr,"%d %f ", chain->mc, model->logL-data->logLc);
fprintf(fptr,"%d %f ", chain->mc, model->logL-data->logLc+model->logLnorm);
fprintf(fptr,"%d ", model->signal->size);
for(ifo=0; ifo<NI; ifo++) fprintf(fptr,"%d ", model->glitch[ifo]->size);
for(ifo=0; ifo<NI; ifo++) fprintf(fptr, "%f ",model->Sn[ifo]);
// fprintf(fptr, "%f %f ",logZ, sqrt(varZ));
if(data->stochasticFlag)
fprintf(fptr,"%f %f ",model->background->logamp,model->background->index);
fprintf(fptr,"%f %f ",model->logL,model->logLnorm);
fprintf(fptr,"\n");
}
......
......@@ -36,6 +36,7 @@ void print_run_stats(FILE *fptr, struct Data *data, struct Chain *chain);
void print_run_flags(FILE *fptr, struct Data *data, struct Prior *prior);
void print_chain_files(struct Data *data, struct Chain *chain, struct Model **model, struct BayesLineParams ***bayesline, int ic);
void print_chain_status(struct Data *data, struct Chain *chain, struct Model **model, int searchFlag);
void flush_chain_files(struct Data *data, struct Chain *chain, int ic);
void print_model(FILE *fptr, struct Data *data, struct Chain *chain, struct Model *model);
void print_signal_model(FILE *fptr, struct Model *model);
......
......@@ -1121,6 +1121,7 @@ void RJMCMC(struct Data *data, struct Model **model, struct BayesLineParams ***b
//print state of cold chain to file
print_chain_files(data, chain, model, bayesline, 0);
if(chain->mc%1000) flush_chain_files(data,chain,0);
if(data->verboseFlag)
{
//only print hot chains if asked to
......@@ -1181,6 +1182,7 @@ void RJMCMC(struct Data *data, struct Model **model, struct BayesLineParams ***b
for(ic=0; ic<NC; ic++) fprintf(tfile,"%g ",chain->A[ic]);
for(ic=0; ic<NC; ic++) fprintf(tfile,"%g ",(double)chain->ptacc[ic]/(double)chain->ptprop[ic]);
fprintf(tfile,"\n");
fflush(tfile);
}
//adapt PTMCMC spacing and reset various counters
......
......@@ -373,7 +373,9 @@ void initialize_priors(struct Data *data, struct Prior *prior, int omax)
// wavelet density prior
prior->Nwavelet = malloc(200*sizeof(double));
double b = 2.9;
for(i=0; i<200; i++) prior->Nwavelet[i] = log(((double)i*4.0*sqrt(3.)/(LAL_PI*pow(b,2.)))/(3.0+pow((double)i/b,4.)));
//TODO Nwavelet unstable at i=0?
for(i=1; i<200; i++) prior->Nwavelet[i] = log(((double)i*4.0*sqrt(3.)/(LAL_PI*pow(b,2.)))/(3.0+pow((double)i/b,4.)));
prior->Nwavelet[1]=prior->Nwavelet[0];
prior->smin = 0;
prior->smax = data->Dmax;
......
......@@ -1138,7 +1138,7 @@ void TFprop_setup(struct Data *data, struct Model *model, double **range, struct
double Qmin, Qmax;
double tmin, tmax;
double fmin, fmax;
double dt, dfx, dQx, dV;
double dfx, dQx, dV;
double fsnr;
double tsnr;
double norm;
......@@ -1162,8 +1162,6 @@ void TFprop_setup(struct Data *data, struct Model *model, double **range, struct
params[3] = 1.0;
params[4] = 0.0;
dt = (tmax-tmin)/(double)(nt);//8*data->Tobs/(double)data->N;
dfx = (fmax-fmin)/(double)(nf); // spacing of grid in frequency
dQx = (Qmax-Qmin)/(double)(nQ); // spacing of grid in frequency
......
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