Skip to the navigation links
Last modified: 24 October 2023


Bugs: dmimgcalc

Table of Contents




Mixing scalar and array values  (07 Mar 2008)

Users need to be careful when trying to mix scalar and array operations to get the correct results. For example

unix% dmimgcalc img.fits none out.fits op="imgout=5"

Does not produce an image the same size as img.fits whose values are all 5. Rather one gets a 1x1 image with the value=5. To get an image with all values set to 5 we can do something like

unix% dmimgcalc img.fits none out.fits op="imgout=(img1*0)+5"
unix% dmimgcalc img.fits none out.fits op="imgout=(img1/img1)*5"


The operation string cannot exceed 1023 characters.

The operation string is limited to 1023 characters (the imgout= string counts against that 1023 limit). Values longer than 1023 characters cause a string buffer overflow (ie memory corruption) leading to unpredicatable behavior.

log() of integer values

Using the log or log10 operator on integer pixel values returns an integer value. The value is truncated.


If unsure of the datatype, the value can be explicitly cast to a real-valued number


Boolean operators - such as < and > - are not working on arrays (e.g. images).

Note that threshold conditions may be more easily applied by using dmimgthresh instead of this tool.

dmimgcalc corrupts the file history  (07 Mar 2008)

dmimgcalc corrupts the history records in the file header, duplicating previous history entries.

The tool segmentation faults if the input file is a table  (28 Feb 2012)

unix% dmimgcalc infile=img.a,img.b infile2= \
      outfile=sub.fits op='imgout=img1-img2'
warning: ASPTYPE has different value...Merged...
BTIMDRFT not present in all input files...FAIL...
BTIMNULL not present in all input files...FAIL...
BTIMRATE not present in all input files...FAIL...
warning: DATAMODE has different value...Merged...
warning: DS_IDENT has different value...Merged...
omit - FOC_LEN values different more than 1.000000
warning: OBJECT has different value...Merged...
warning: OBSERVER has different value...Merged...
omit - ROLL_NOM values different more than 1.000000
warning: SEQ_NUM has different value...Merged...
warning: TITLE has different value...Merged...
# 49970: Received error signal SIGSEGV-segmentation violation.
# 49970: An invalid memory reference was made.
# 49970: segmentation fault: dmimgcalc (1) is: exit_upon_error->NULL

unix% dmlist img.a blocks

Dataset: img.a

     Block Name                          Type         Dimensions
Block    1: PRIMARY                        Null        
Block    2: EVENTS                         Table        15 cols x 634221   rows
Block    3: GTI7                           Table         2 cols x 1        rows