Commit 119cca6c authored by Marcella Wijngaarden's avatar Marcella Wijngaarden

Merge branch 'BW+QuickCBC' into 'BW+QuickCBC'

do some clean up

See merge request marcella.wijngaarden/bayeswave!6
parents 576178fa 4cb1bddf
......@@ -6,4 +6,4 @@ This page describes how the BayesCBC module for BayesWave.
- `chains/cbc_model.dat.<i>` where i is the chain number (BW prints cold chain
0 by default, with verbose flags chain files for all chains are printed)
- `wavesCBC/*` CBC waveforms
- `waveforms/*` CBC waveforms
......@@ -580,7 +580,7 @@ void printwaveall(struct Net *net, int N, RealVector *freq, double *paramx, doub
// printf("%d %f %f\n", iter, exp(paramx[0])/MSUN_SI, fs);
for (id = 0; id < net->Nifo; ++id)
{
sprintf(command, "wavesCBC/wavefcheck_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
sprintf(command, "waveforms/wavefcheck_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
out = fopen(command,"w");
for (i = 1; i < N/2; ++i)
{
......@@ -692,7 +692,7 @@ void printwaveall(struct Net *net, int N, RealVector *freq, double *paramx, doub
for (id = 0; id < net->Nifo; ++id)
{
sprintf(command, "wavesCBC/wave_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
sprintf(command, "waveforms/wave_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
out = fopen(command,"w");
for (i = 0; i < N; ++i)
{
......@@ -700,7 +700,7 @@ void printwaveall(struct Net *net, int N, RealVector *freq, double *paramx, doub
}
fclose(out);
sprintf(command, "wavesCBC/wavedata_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
sprintf(command, "waveforms/wavedata_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
out = fopen(command,"w");
for (i = 0; i < N; ++i)
{
......@@ -711,7 +711,7 @@ void printwaveall(struct Net *net, int N, RealVector *freq, double *paramx, doub
for (id = 0; id < net->Nifo; ++id)
{
sprintf(command, "wavesCBC/wavef_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
sprintf(command, "waveforms/wavef_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
out = fopen(command,"w");
for (i = 1; i < N/2; ++i)
{
......@@ -735,7 +735,7 @@ void printwaveall(struct Net *net, int N, RealVector *freq, double *paramx, doub
// printf(" amplitude factor: %f\n\n",fac);
for (id = 0; id < net->Nifo; ++id)
{
sprintf(command, "wavesCBC/wavewhite_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
sprintf(command, "waveforms/wavewhite_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
out = fopen(command,"w");
for (i = 0; i < N; ++i)
{
......@@ -743,7 +743,7 @@ void printwaveall(struct Net *net, int N, RealVector *freq, double *paramx, doub
}
fclose(out);
sprintf(command, "wavesCBC/wavedatawhite_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
sprintf(command, "waveforms/wavedatawhite_%d_%d_%d_%d.dat", iter, (int)(Tobs), (int)ttrig, net->labels[id]);
out = fopen(command,"w");
for (i = 0; i < N; ++i)
{
......
......@@ -159,7 +159,6 @@ int main(int argc, char *argv[])
mode_t process_mask = umask(0);
mkdir("chains", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
mkdir("waveforms", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
mkdir("wavesCBC", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if(data->checkpointFlag) mkdir("checkpoint",S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
sprintf(filename,"%ssnr",data->runName);
mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
......
......@@ -1106,7 +1106,10 @@ void RJMCMC(struct Data *data, struct Model **model, struct BayesLineParams ***b
if(data->runPhase==0)snprintf(modelname,MAXSTRINGSIZE,"%sclean",data->runName);
else
{
if(!data->glitchFlag && !data->signalFlag)
if(data->cbcFlag)
snprintf(modelname,MAXSTRINGSIZE,"%scbc",data->runName);
else if(!data->glitchFlag && !data->signalFlag)
snprintf(modelname,MAXSTRINGSIZE,"%snoise",data->runName);
else if(data->glitchFlag && !data->signalFlag)
......@@ -1429,6 +1432,15 @@ void RJMCMC(struct Data *data, struct Model **model, struct BayesLineParams ***b
sprintf(filename,"waveforms/%s_colored_wave_%s_%d.dat", modelname, data->ifos[ifo], frame);
print_colored_time_domain_waveforms(filename, model[chain->index[0]]->response[ifo], N, data->Tobs, data->imin, data->imax, prior->range[0][0], prior->range[0][1]);
}
if(data->cbcFlag)
{
sprintf(filename,"waveforms/%s_cbc_%s_%d.dat", modelname, data->ifos[ifo], frame);
print_time_domain_waveforms(filename, model[chain->index[0]]->cbctemplate[ifo], N, model[chain->index[0]]->Snf[ifo], data->Tobs, data->imin, data->imax, prior->range[0][0], prior->range[0][1]);
sprintf(filename,"waveforms/%s_colored_cbc_%s_%d.dat", modelname, data->ifos[ifo], frame);
print_colored_time_domain_waveforms(filename, model[chain->index[0]]->cbctemplate[ifo], N, data->Tobs, data->imin, data->imax, prior->range[0][0], prior->range[0][1]);
}
}
frame++;
}
......@@ -2631,7 +2643,8 @@ void EvolveBayesCBCParameters(struct Data *data, struct Model **model, struct ba
projectCBCWaveform(model_x->cbcamphase, N, NI, fmin, data->Tobs, model_x->extParams, model_x->cbctemplate, projection->dtimes, projection->Fplus, projection->Fcross);
// Save 200 waveforms temporarily for checking residuals + template
if (ic==0 && bayescbc->debug == 1 && chain->mc%(chain->count/200)==0) print_projected_cbc_waveform(bayescbc->SN, data->Tobs, data->trigtime, model_x->cbctemplate, bayescbc->D, N, bayescbc->mxc[0], bayescbc);
//if (ic==0 && bayescbc->debug == 1 && chain->mc%(chain->count/200)==0) print_projected_cbc_waveform(bayescbc->SN, data->Tobs, data->trigtime, model_x->cbctemplate, bayescbc->D, N, bayescbc->mxc[0], bayescbc);
// Recompute likelihoods of current chain
model_x->logLnorm = 0.0;
......
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