Commit dd064da9 authored by Tyson Littenberg's avatar Tyson Littenberg
Browse files

modify amplitude proposals, explicitly reset checkpoint flags


git-svn-id: https://svn.ligo.caltech.edu/svn/bayeswave/trunk@573 c56465c9-8126-4a4f-9d7d-ac845eff4865
parent 246d2f9d
......@@ -886,6 +886,11 @@ void print_run_flags(FILE *fptr, struct Data *data, struct Prior *prior)
else fprintf(fptr, "DISABLED");
fprintf(fptr, "\n");
fprintf(fptr, " amplitude proposal is .... ");
if(data->amplitudeProposalFlag) fprintf(fptr, "ENABLED");
else fprintf(fptr, "DISABLED");
fprintf(fptr, "\n");
fprintf(fptr, " thermo. integration ...... ");
if(data->splineEvidenceFlag) fprintf(fptr, "SPLINE");
else fprintf(fptr, "TRAPEZOID");
......
......@@ -56,6 +56,9 @@ static void check_interrupt(volatile sig_atomic_t __bayeswave_exitFlag)
{
if(__bayeswave_exitFlag)
{
__bayeswave_saveStateFlag=0;
__bayeswave_exitFlag=0;
fprintf(stdout,"\n");
fprintf(stdout,"\n");
fprintf(stdout,"Interrupt signal recieved\n");
......@@ -1637,6 +1640,9 @@ void EvolveIntrinsicParameters(struct Data *data, struct Prior *prior, struct Mo
//ratio of TF proposals to proximity proposals
double TFtoProx = data->TFtoProx;
double FisherRate = 0.8;
if(data->constantLogLFlag) FisherRate = 0.2;
double scale = 1./sqrt(6.);//??
......@@ -1957,21 +1963,36 @@ void EvolveIntrinsicParameters(struct Data *data, struct Prior *prior, struct Mo
then computes the Fisher at y to compute the proposal
densities to maintain detailed balance
*/
if(ran2(seed)<0.8)
if(ran2(seed)<0.1)
{
//TODO: Try new fisher proposal
if(det==-1) intrinsic_fisher_proposal(range, paramsx[ii], paramsy[ii], model_x->SnGeo, 1.0, &logqx, &logqy, scale, seed, Tobs, &test);
else intrinsic_fisher_proposal(range, paramsx[ii], paramsy[ii], model_x->Snf[det], 1.0, &logqx, &logqy, scale, seed, Tobs, &test);
// if(det==-1) intrinsic_fisher_proposal_2(model->x,range, paramsx[ii], paramsy[ii], &logqx, &logqy, seed, &test);
// else intrinsic_fisher_proposal_2(model->x,range, paramsx[ii], paramsy[ii], &logqx, &logqy, seed, &test);
intrinsic_halfcycle_proposal(paramsx[ii],paramsy[ii],seed);
}
else if(ran2(seed)<0.9)
else if(ran2(seed)<FisherRate)
{
intrinsic_halfcycle_proposal(paramsx[ii],paramsy[ii],seed);
//TODO: Try new fisher proposal
if(det==-1) intrinsic_fisher_proposal(range, paramsx[ii], paramsy[ii], model_x->SnGeo, 1.0, &logqx, &logqy, scale, seed, Tobs, &test);
else intrinsic_fisher_proposal(range, paramsx[ii], paramsy[ii], model_x->Snf[det], 1.0, &logqx, &logqy, scale, seed, Tobs, &test);
// if(det==-1) intrinsic_fisher_proposal_2(model->x,range, paramsx[ii], paramsy[ii], &logqx, &logqy, seed, &test);
// else intrinsic_fisher_proposal_2(model->x,range, paramsx[ii], paramsy[ii], &logqx, &logqy, seed, &test);
}
else
{
draw_wavelet_params(det, paramsy[ii], data, range, seed);
if(ran2(seed)<0.5 && data->amplitudeProposalFlag)
{
if(det==-1)
{
data->signal_amplitude_proposal(paramsy[ii], model_x->SnGeo, 1.0, seed, data->Tobs, prior->range, prior->sSNRpeak);
logqy += ( data->signal_amplitude_prior(paramsy[ii], model_x->SnGeo, 1.0, data->Tobs, prior->sSNRpeak) );
}
else
{
data->glitch_amplitude_proposal(paramsy[ii], model_x->Snf[det], Sny[det], seed, data->Tobs, prior->range, prior->gSNRpeak);
logqy += (data->glitch_amplitude_prior(paramsy[ii], model_x->Snf[det], Sny[det], data->Tobs, prior->gSNRpeak) );
}
}
}
}//end perturb step
}//end !noiseOnlyFlag check
......
......@@ -361,8 +361,8 @@ void initialize_priors(struct Data *data, struct Prior *prior, int omax)
//Use S6 strain as default
else
{
Amin = 1.e-26;
Amax = 1.e-18;
Amin = 4.78089288388547e-25;
Amax = 5.74952226429356e-19;
}
//double dt = data->Tobs/(double)data->tsize;
......@@ -387,8 +387,8 @@ void initialize_priors(struct Data *data, struct Prior *prior, int omax)
prior->range[1][1] = fmax;
prior->range[2][0] = Qmin;
prior->range[2][1] = Qmax;
prior->range[3][0] = 0;//Amin;
prior->range[3][1] = 200;//Amax;
prior->range[3][0] = Amin;
prior->range[3][1] = Amax;
prior->range[4][0] = 0.0;
prior->range[4][1] = LAL_TWOPI;
......@@ -544,8 +544,8 @@ void reset_priors(struct Data *data, struct Prior *prior)
//Use S6 strain as default
else
{
Amin = 1.e-26;
Amax = 1.e-18;
Amin = 4.78089288388547e-25;
Amax = 5.74952226429356e-19;
}
double Qmin = data->Qmin;
......@@ -574,8 +574,8 @@ void reset_priors(struct Data *data, struct Prior *prior)
prior->range[1][1] = fmax;
prior->range[2][0] = Qmin;
prior->range[2][1] = Qmax;
prior->range[3][0] = 0;//Amin;
prior->range[3][1] = 200;//Amax;
prior->range[3][0] = Amin;
prior->range[3][1] = Amax;
prior->range[4][0] = 0.0;
prior->range[4][1] = LAL_TWOPI;
......
......@@ -49,8 +49,8 @@ void draw_glitch_amplitude(double *params, double *Snf, double Sa, long *seed, d
i = (int)(params[1]*Tobs);
double SNRmin = range[3][0];//*sqrt((params[2]/(2.0*RT2PI*params[1]))/(Sa*Snf[i]*2.0/Tobs));
double SNRmax = range[3][1];//*sqrt((params[2]/(2.0*RT2PI*params[1]))/(Sa*Snf[i]*2.0/Tobs));
double SNRmin = range[3][0]*sqrt((params[2]/(2.0*RT2PI*params[1]))/(Sa*Snf[i]*2.0/Tobs));
double SNRmax = range[3][1]*sqrt((params[2]/(2.0*RT2PI*params[1]))/(Sa*Snf[i]*2.0/Tobs));
k = 0;
......@@ -121,8 +121,8 @@ void draw_signal_amplitude(double *params, double *Snf, double Sa, long *seed, d
i = (int)(params[1]*Tobs);
double SNRmin = range[3][0];//*sqrt((params[2]/(2.0*RT2PI*params[1]))/(Sa*Snf[i]*2.0/Tobs));
double SNRmax = range[3][1];//*sqrt((params[2]/(2.0*RT2PI*params[1]))/(Sa*Snf[i]*2.0/Tobs));
double SNRmin = range[3][0]*sqrt((params[2]/(2.0*RT2PI*params[1]))/(Sa*Snf[i]*2.0/Tobs));
double SNRmax = range[3][1]*sqrt((params[2]/(2.0*RT2PI*params[1]))/(Sa*Snf[i]*2.0/Tobs));
k = 0;
......@@ -156,6 +156,10 @@ void draw_signal_amplitude(double *params, double *Snf, double Sa, long *seed, d
//SNR defined with Sn(f) but Snf array holdes <n_i^2>
params[3] = SNR/sqrt((params[2]/(2.0*RT2PI*params[1]))/(Sa*Snf[i]*2.0/Tobs));
// FILE *temp=fopen("prior.dat","a");
// fprintf(temp,"%lg\n",params[3]);
// fclose(temp);
}
......
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