Skip to content

Commit

Permalink
Merge pull request #89 from mcara/fix-truncated-output
Browse files Browse the repository at this point in the history
Fix incorrect identification of lines to be skipped
  • Loading branch information
mcara authored Feb 9, 2023
2 parents dbecf36 + 87650a1 commit 740d94c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
12 changes: 11 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
Release Notes
=============

.. 1.13.7 (unreleased)
.. 1.13.8 (unreleased)
===================
1.13.7 (2023-02-09)
===================

- Fixed a bug in identification of lines in input images that should be skipped
because they would not map to the output image. This bug may result in large
chunks of input image incorrectly missing from the resampled image. [#89]


1.13.6 (2021-08-05)
===================

Expand All @@ -24,6 +33,7 @@ Release Notes
resulted in shifts of the resampled image typically by 0.5 pixels compared
to the location indicated by the WCS. [#83]


1.13.4 (2021-12-23)
===================

Expand Down
17 changes: 10 additions & 7 deletions src/cdrizzlemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,18 @@ shrink_segment(struct segment *self,
PyArrayObject *array,
int (*is_bad_value)(PyArrayObject *, int, int)) {

int i, j, imin, imax, jmin, jmax;
int i, j, imin, imax, jmin, jmax, i1, i2, j1, j2;

imin = self->point[1][0];
jmin = self->point[1][1];

for (j = self->point[0][1]; j < self->point[1][1]; ++j) {
for (i = self->point[0][0]; i < self->point[1][0]; ++ i) {
j1 = (int) ceil(self->point[1][1]);
j2 = (int) self->point[0][1];
i1 = (int) ceil(self->point[1][0]);
i2 = (int) self->point[0][0];

for (j = j2; j < j1; ++j) {
for (i = i2; i < i1; ++i) {
if (! is_bad_value(array, i, j)) {
if (i < imin) {
imin = i;
Expand All @@ -125,9 +130,8 @@ shrink_segment(struct segment *self,

imax = self->point[0][0];
jmax = self->point[0][1];

for (j = self->point[1][1]; j > self->point[0][1]; --j) {
for (i = self->point[1][0]; i > self->point[0][0]; -- i) {
for (j = j1; j > j2; --j) {
for (i = i1; i > i2; --i) {
if (! is_bad_value(array, i-1, j-1)) {
if (i > imax) {
imax = i;
Expand All @@ -139,7 +143,6 @@ shrink_segment(struct segment *self,
}
}
}

initialize_segment(self, imin, jmin, imax, jmax);
self->invalid = imin >= imax || jmin >= jmax;
return;
Expand Down

0 comments on commit 740d94c

Please sign in to comment.