Skip to content

Commit

Permalink
Merge pull request #8 from fermi-lat/master
Browse files Browse the repository at this point in the history
gtorbsim profile interpolation fix
  • Loading branch information
jasercion authored Dec 16, 2024
2 parents 443d9d2 + e3b8918 commit b1652a0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/read_ephem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2612,7 +2612,8 @@ void doProfiled(double start, double end, double res, double *tms,

for(jc=0; jc<=ncycles+1; jc++){
if(jc > 0){
Lincr += difincr*(difincr/(fabs(difincr)));
//Lincr += difincr*(difincr/(fabs(difincr)));
Lincr += difincr;
if((int)fabs(Lincr) >= (int)(res*secInDay)){
tms[16] = Ltime+(Lincr/fabs(Lincr))*(double)((int)(res*secInDay));
Lincr -= (Lincr/fabs(Lincr))*(double)((int)(res*secInDay));
Expand Down Expand Up @@ -2748,6 +2749,12 @@ double InterpProfile(double *tms, double *ofst, double res){
} else {
Ltms[16] = tms[16]-(double)drem+(double)resS;
difincr = -(double)drem+(double)resS;
// difincr should be negative if Ltms[16] > tms[16]
// i.e, if the interpolated profile is longer than the orginal profile,
// then the correction to the interpolated profile should shorten it
if(Ltms[16] > tms[16]){
difincr *= -1;
}
}

if(Ltms[16] == Ltms[15]){
Expand Down

0 comments on commit b1652a0

Please sign in to comment.