Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtorbsim profile interpolation fix #8

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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