[daip] Bug and gotcha feature in NINER (31DEC18) {External}

Eric Greisen egreisen at nrao.edu
Thu Sep 26 15:31:16 EDT 2024


I did test this before answering you.  The NORT mask is exactly as specified in the code and when applied to a circular beam produces a bright spot on the north side of the beam and a dark spot on the south side.  Other possible choices do a similar operation. Perhaps you are considering the matrix operation in some different order.

Eric



________________________________
From: Patrick Leahy <j.p.leahy at manchester.ac.uk>
Sent: Thursday, September 26, 2024 12:45 PM
To: Eric Greisen <egreisen at nrao.edu>; aipsmail <aipsmail at nrao.edu>
Cc: Phoebe Ryder <phoebe.ryder at postgrad.manchester.ac.uk>
Subject: Re: [daip] Bug and gotcha feature in NINER (31DEC18) {External}

Hi Eric,
      Good to hear from you! Thanks - addition to the help file is certainly valuable. But in the help file (on-line version at www.aips.nrao.edu, as well as our antique) the "NORT" mask is given as

 1  1  1
 1 -2  1
-1 -1 -1

That would give a positive value for intensity increasing south to north, i.e. when the gradient vector points north; 'SOUT'  is given as the other way up. Similarly the NE, SE, NW, and SW masks in the help file imply that N points up and S points down, whereas the actual output is the other way round.  So the code is definitely inconsistent with the help file masks (except for the EAST mask).  The help file would be even clearer if "some direction" was replaced by "the specified direction".  We had just assumed that the names referred to the direction of the gradient vector picked out by the mask, and it looks like that was also assumed by whoever wrote the help file.

cheers,
            Paddy
________________________________
From: Eric Greisen <egreisen at nrao.edu>
Sent: Thursday, September 26, 2024 18:33
To: aipsmail <aipsmail at nrao.edu>; Patrick Leahy <j.p.leahy at manchester.ac.uk>
Cc: Phoebe Ryder <phoebe.ryder at postgrad.manchester.ac.uk>
Subject: Re: [daip] Bug and gotcha feature in NINER (31DEC18) {External}

Actually, I think the code is correct except for the -2 typo with East to the left and North at the top.  I added things to the help file (for 31DEC24 not your antique).

             Built-in gradient masks.  The first 8 "coordinate"
             masks, assuming the image has North to the top and East
             to the left, produce positive values when traversing
             from the coordinate (e.g. North to South) when the image
             values are increasing.  If the image is not in the
             usual configuration, the "coordinate" names are
            misleading.  The matrices are applied as stated.

NORT, NE, EAST, SE SOUT, SW, WEST, NW:
      these are special cases of NINE. The kernels are
        arranged so that they are directional derivative
        filters. The output picture resembles a landscape
        viewed from above with illumination at a glancing
        angle from some direction.  Note that the coordinate
        labels assume that the image is oriented with the
        North at the top and East at the left.  With the
        illumination from the north, for example, the north
        side of a peak will be bright (positive) and the
        south side will be dark (negative).

Cheers

Eric Greisen
________________________________
From: Daip <daip-bounces at listmgr.nrao.edu> on behalf of Patrick Leahy via Daip <daip at listmgr.nrao.edu>
Sent: Thursday, September 26, 2024 10:18 AM
To: aipsmail <aipsmail at nrao.edu>
Cc: Phoebe Ryder <phoebe.ryder at postgrad.manchester.ac.uk>
Subject: [daip] Bug and gotcha feature in NINER (31DEC18) {External}

Hello AIPS - hope that's still Eric:

This is about NINER version 31DEC18 (the only version we have installed at Jodrell Bank). I checked CHANGES.DOC to see if this has been fixed in more recent version, but I don't think so: NINER is only mentioned on item 15763.  April 19, 2022, which doesn't look as if it relates to what we see.

BUG: OPCODE = 'NORT' gives a positive answer if the intensity is increasing from north to south, while OPCODE='SOUT' gives a positive answer if intensity is increasing south to north - these are the wrong way round and not what would be produced by the 3x3 grids shown in the HELP.  I'm guessing that the masks are swapped although I haven't looked into the code.

FEATURE: OPCODE 'EAST' and 'WEST' give the results expected from the masks in HELP (although I think there is a typo in the WEST mask which has a -2 in the RH row where I would expect a -1).
However, these are defined as on a map looking down, not up, i.e. they imply that East is on the right. The NE, SE, SW, NW masks are consistent with this. Rather than changing the code I'd suggest that this was just highlighted in the task description, i.e. add "NB: NINER's compass points are defined with East on the right, i.e. the geographical, not astronomical convention."

A simple test to show this (which we have done) is to run NINER on a PATGN image containing a large Gaussian.

Best wishes,
            Paddy Leahy and Phoebe Ryder




________________________________
From: Patrick Leahy <j.p.leahy at manchester.ac.uk>
Sent: Thursday, September 26, 2024 12:45 PM
To: Eric Greisen <egreisen at nrao.edu>; aipsmail <aipsmail at nrao.edu>
Cc: Phoebe Ryder <phoebe.ryder at postgrad.manchester.ac.uk>
Subject: Re: [daip] Bug and gotcha feature in NINER (31DEC18) {External}

Hi Eric,
      Good to hear from you! Thanks - addition to the help file is certainly valuable. But in the help file (on-line version at www.aips.nrao.edu, as well as our antique) the "NORT" mask is given as

 1  1  1
 1 -2  1
-1 -1 -1

That would give a positive value for intensity increasing south to north, i.e. when the gradient vector points north; 'SOUT'  is given as the other way up. Similarly the NE, SE, NW, and SW masks in the help file imply that N points up and S points down, whereas the actual output is the other way round.  So the code is definitely inconsistent with the help file masks (except for the EAST mask).  The help file would be even clearer if "some direction" was replaced by "the specified direction".  We had just assumed that the names referred to the direction of the gradient vector picked out by the mask, and it looks like that was also assumed by whoever wrote the help file.

cheers,
            Paddy
________________________________
From: Eric Greisen <egreisen at nrao.edu>
Sent: Thursday, September 26, 2024 18:33
To: aipsmail <aipsmail at nrao.edu>; Patrick Leahy <j.p.leahy at manchester.ac.uk>
Cc: Phoebe Ryder <phoebe.ryder at postgrad.manchester.ac.uk>
Subject: Re: [daip] Bug and gotcha feature in NINER (31DEC18) {External}

Actually, I think the code is correct except for the -2 typo with East to the left and North at the top.  I added things to the help file (for 31DEC24 not your antique).

             Built-in gradient masks.  The first 8 "coordinate"
             masks, assuming the image has North to the top and East
             to the left, produce positive values when traversing
             from the coordinate (e.g. North to South) when the image
             values are increasing.  If the image is not in the
             usual configuration, the "coordinate" names are
            misleading.  The matrices are applied as stated.

NORT, NE, EAST, SE SOUT, SW, WEST, NW:
      these are special cases of NINE. The kernels are
        arranged so that they are directional derivative
        filters. The output picture resembles a landscape
        viewed from above with illumination at a glancing
        angle from some direction.  Note that the coordinate
        labels assume that the image is oriented with the
        North at the top and East at the left.  With the
        illumination from the north, for example, the north
        side of a peak will be bright (positive) and the
        south side will be dark (negative).

Cheers

Eric Greisen
________________________________
From: Daip <daip-bounces at listmgr.nrao.edu> on behalf of Patrick Leahy via Daip <daip at listmgr.nrao.edu>
Sent: Thursday, September 26, 2024 10:18 AM
To: aipsmail <aipsmail at nrao.edu>
Cc: Phoebe Ryder <phoebe.ryder at postgrad.manchester.ac.uk>
Subject: [daip] Bug and gotcha feature in NINER (31DEC18) {External}

Hello AIPS - hope that's still Eric:

This is about NINER version 31DEC18 (the only version we have installed at Jodrell Bank). I checked CHANGES.DOC to see if this has been fixed in more recent version, but I don't think so: NINER is only mentioned on item 15763.  April 19, 2022, which doesn't look as if it relates to what we see.

BUG: OPCODE = 'NORT' gives a positive answer if the intensity is increasing from north to south, while OPCODE='SOUT' gives a positive answer if intensity is increasing south to north - these are the wrong way round and not what would be produced by the 3x3 grids shown in the HELP.  I'm guessing that the masks are swapped although I haven't looked into the code.

FEATURE: OPCODE 'EAST' and 'WEST' give the results expected from the masks in HELP (although I think there is a typo in the WEST mask which has a -2 in the RH row where I would expect a -1).
However, these are defined as on a map looking down, not up, i.e. they imply that East is on the right. The NE, SE, SW, NW masks are consistent with this. Rather than changing the code I'd suggest that this was just highlighted in the task description, i.e. add "NB: NINER's compass points are defined with East on the right, i.e. the geographical, not astronomical convention."

A simple test to show this (which we have done) is to run NINER on a PATGN image containing a large Gaussian.

Best wishes,
            Paddy Leahy and Phoebe Ryder



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listmgr.nrao.edu/pipermail/daip/attachments/20240926/5825831f/attachment-0001.html>


More information about the Daip mailing list