Skip to content

Commit

Permalink
Merge pull request #224 from glenco/nt/weight-check
Browse files Browse the repository at this point in the history
check that weights are positive, closes #138
  • Loading branch information
Nicolas Tessore committed Jan 21, 2016
2 parents 795056b + 91f2536 commit ac2fa27
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lensed.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,21 @@ int main(int argc, char* argv[])
}
}

// make sure weights are positive
for(size_t i = 0; i < lensed->size; ++i)
{
if(!(lensed->weight[i] > 0))
{
warn("non-positive values in weights\n"
"Some pixel weights are not positive numbers. This will "
"almost certainly lead to wrong results. If you did not "
"provide the weight map yourself, the reason might be a "
"missing or too small number in the \"offset\" option for "
"the background that was subtracted from the image.");
break;
}
}


/***********
* results *
Expand Down

0 comments on commit ac2fa27

Please sign in to comment.