gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master ff0b76d 018/125: New Data types section in boo


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master ff0b76d 018/125: New Data types section in book, bitwise not added
Date: Sun, 23 Apr 2017 22:36:28 -0400 (EDT)

branch: master
commit ff0b76d6908b1f5fa25a13a74dd2148b7e76ce36
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    New Data types section in book, bitwise not added
    
    The explanation that was previously under the `uchar' operator in
    Arithmetic on data types has been moved to its own separate subsection, and
    made more clear.
    
    Also, the bitwise not (or one's component) operator is now implemented in
    `gal_data_arithmetic' and thus the Arithmetic program.
    
    Also, in preparation for more detailed use of the root data structure, a
    new `next' pointer is now added to it so the datatypes can be used as
    linked lists.
---
 bin/arithmetic/arithmetic.c   |   2 +
 doc/gnuastro.texi             | 236 ++++++++++++++++++++++++------------------
 lib/data-arithmetic-onlyint.c |  69 ++++++++++++
 lib/data-arithmetic-onlyint.h |   4 +-
 lib/data-arithmetic-other.h   |   4 +-
 lib/data.c                    |   3 +-
 lib/gnuastro/data.h           |  23 ++--
 7 files changed, 228 insertions(+), 113 deletions(-)

diff --git a/bin/arithmetic/arithmetic.c b/bin/arithmetic/arithmetic.c
index 8c6569c..604b3f4 100644
--- a/bin/arithmetic/arithmetic.c
+++ b/bin/arithmetic/arithmetic.c
@@ -166,6 +166,8 @@ reversepolish(struct imgarithparams *p)
             { op=GAL_DATA_OPERATOR_BITLSH;        nop=2;  }
           else if (!strcmp(token->v, "rshift"))
             { op=GAL_DATA_OPERATOR_BITRSH;        nop=2;  }
+          else if (!strcmp(token->v, "bitnot"))
+            { op=GAL_DATA_OPERATOR_BITNOT;        nop=1;  }
 
           /* Type conversion. */
           else if (!strcmp(token->v, "uchar"))
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index a5e167b..1ff5a92 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -360,6 +360,7 @@ Invoking ImageCrop
 Arithmetic
 
 * Reverse polish notation::     The current notation style for Arithmetic
+* Data types::                  How bits are read as numbers
 * Arithmetic operators::        List of operators known to Arithmetic
 * Invoking astarithmetic::      How to run Arithmetic: options and output
 
@@ -7057,11 +7058,12 @@ more information on how to run Arithmetic, please see
 
 @menu
 * Reverse polish notation::     The current notation style for Arithmetic
+* Data types::                  How bits are read as numbers
 * Arithmetic operators::        List of operators known to Arithmetic
 * Invoking astarithmetic::      How to run Arithmetic: options and output
 @end menu
 
address@hidden Reverse polish notation, Arithmetic operators, Arithmetic, 
Arithmetic
address@hidden Reverse polish notation, Data types, Arithmetic, Arithmetic
 @subsection Reverse polish notation
 
 @cindex Postfix notation
@@ -7118,7 +7120,69 @@ address@hidden the EPS and PDF part of @ref{Recognized 
file types}
 for a little more on the Postscript language.} (the programming language in
 Postscript and compiled into PDF files) uses this notation.
 
address@hidden Arithmetic operators, Invoking astarithmetic, Reverse polish 
notation, Arithmetic
+
+
+
+
address@hidden Data types, Arithmetic operators, Reverse polish notation, 
Arithmetic
address@hidden Data types
+
address@hidden Bit
address@hidden Type
+At the lowest level, the computer stores everything in terms of @code{1} or
address@hidden For example, each program in Gnuastro, or each astronomical image
+you take with the telescope is actually a string of millions of these zeros
+and ones. The space required to keep either of these two values is the
+smallest unit of storage, and is known as a @emph{bit}. Understanding and
+manipulating this string of bits is extremely hard for most people,
+therefore, we define packages with a certain number of these bits along
+with a standard on how to interpret these bits as @emph{type}s.
+
+The most basic standard for reading the bits is integer numbers. Since we
+use CFITSIO, we define the @code{char}, @code{short}, or @code{long}
+integer types. These types can store an integer number (@mymath{..., -2,
+-1, 0, 1, 2, ...}), with an increasing number of bytes/bits (and thus
+larger limits). The range of integers each can represent is: @mymath{(-2^7,
+..., 2^7-1)}, @mymath{(-2^{15}, ..., 2^{15}-1}), and @mymath{(-2^{32}, ...,
+2^{31}-1)} respectively. One bit in the above types is dedicated to the
+number's sign (positive or negative). So, there is also an @code{unsigned}
+version where all the bits are counted in calculating the number. The
address@hidden types thus have larger positive limits, but no negative
+value with ranges @mymath{(0, ..., 2^8-1)}, @mymath{(0, ..., 2^{16}-1}),
+and @mymath{(0, ..., 2^{32}-1)} respectively. When the context of your work
+doesn't involve negative numbers (for example labeled images, where pixels
+can only have zero or positive integer values), it is best to use the
address@hidden types.
+
+The second standard of converting a given number of bits to numbers is the
+floating point standard, this standard can approximately store any real
+number with a given precision. There are two floating point types in
+CFITSIO: @code{float} and @code{double}, for single and double precision
+floating point numbers respectively. The former is sufficient for data with
+less than 8 significant decimal digits (most astronomical data), while the
+latter is good for less than 16 significant decimal digits. The
+representation of real numbers as bits is much more complex than integers,
+so we won't explain any further, if you are interested have a look in the
address@hidden://en.wikipedia.org/wiki/Floating_point, Wikipedia article}.
+
+With the conversion operators in Gnuastro's Arithmetic, you can change the
+types of data to each other, which is necessary in some contexts. For
+example the program/library, that you intend to feed the data into, only
+accepts floating point values, but you have an integer image. Another
+example can be that you know that your data only has values that fit within
address@hidden or @code{short} types, however it is currently formatted in the
address@hidden type. Operations involving floating point or larger integer
+types are significantly slower than integer or smaller types
+respectively. In the latter case, it also requires much more (by 8 or 4
+times in the example above) storage space. So when you confront such
+situations and want to store/archive/transfter/process the data, it is best
+convert them to the most efficient type.
+
+
+
+
+
address@hidden Arithmetic operators, Invoking astarithmetic, Data types, 
Arithmetic
 @subsection Arithmetic operators
 
 The recognized operators in Arithmetic are listed below. See @ref{Reverse
@@ -7142,6 +7206,16 @@ Multiplication, so address@hidden 5 "*"}'' is equivalent 
to
 @mymath{4\times5}. On the command-line or in scripts, be sure to quote
 the multiplication sign (for example @command{"*"}).
 
address@hidden
address@hidden
address@hidden reminder for multiplication:} please quote the
address@hidden sign (for example, @command{"*"} or
address@hidden'*'}). Without quotation, the shell will replace @command{*}
+with a list of all the files in your working directory which can
+produce unpredictable outputs. In any case, the input images are not
+affected, they are only read.
address@hidden cartouche
+
 @item /
 Division, so address@hidden 5 /}'' is equivalent to @mymath{4/5}.
 
@@ -7302,23 +7376,23 @@ $ astarithmetic in.fits reference.fits 100 gt new.fits 
where
 @end example
 
 @item bitand
-Bitwise AND operator: only bits with values of 1 will get the value of 1,
-the rest will be set to 0. For example (assuming numbers can be written as
-bit strings on the command-line): @code{00101000 00100010 bitand} will give
address@hidden Note that the bitwise operators only work on integer type
-datasets.
+Bitwise AND operator: only bits with values of 1 in both popped operands
+will get the value of 1, the rest will be set to 0. For example (assuming
+numbers can be written as bit strings on the command-line): @code{00101000
+00100010 bitand} will give @code{00100000}. Note that the bitwise operators
+only work on integer type datasets.
 
 @item bitor
-Bitwise inclusive OR operator: The bit will stay 1 if atleast one of the
-two inputs has a 1 value on that bit. For example (assuming numbers can be
-written as bit strings on the command-line): @code{00101000 00100010
-bitand} will give @code{00101010}. Note that the bitwise operators only
-work on integer type datasets.
+Bitwise inclusive OR operator: The bits where atleast one of the two popped
+operands has a 1 value get a value of 1, the others 0. For example
+(assuming numbers can be written as bit strings on the command-line):
address@hidden 00100010 bitand} will give @code{00101010}. Note that the
+bitwise operators only work on integer type datasets.
 
 @item bitxor
 Bitwise exclusive OR operator: A bit will be 1 if it differs between the
-two inputs. For example (assuming numbers can be written as bit strings on
-the command-line): @code{00101000 00100010 bitand} will give
+two popped operands. For example (assuming numbers can be written as bit
+strings on the command-line): @code{00101000 00100010 bitand} will give
 @code{00001010}. Note that the bitwise operators only work on integer type
 datasets.
 
@@ -7337,99 +7411,58 @@ the right by a number of times given by the second 
operand. For example
 @code{00101000 2 rshift} will give @code{00001010}. Note that the bitwise
 operators only work on integer type datasets.
 
address@hidden uchar
-Convert the type of the popped operand to @code{unsigned char}. Different
-types of storange have a different number of bytes (and thus limits), they
-can also represent different standards of reading the bits.
-
-The most basic standard for reading the bits is integer numbers. Since we
-use CFITSIO, we define the @code{char}, @code{short}, or @code{long}
-integer types. These types can store an integer number (@mymath{..., -2,
--1, 0, 1, 2, ...}), with an increasing number of bytes/bits and thus a
-limits. The range of integers each can represent is: @mymath{(-2^7, ...,
-2^7-1)}, @mymath{(-2^{15}, ..., 2^{15}-1}), and @mymath{(-2^{32}, ...,
-2^{31}-1)} respectively. One bit in the above types is dedicated to the
-number's sign (positive or negative). So, there is also an @code{unsigned}
-version where all the bits are counted in calculating the number. The
address@hidden types thus have larger positive limits, but no negative
-value with ranges @mymath{(0, ..., 2^8-1)}, @mymath{(0, ..., 2^{16}-1}),
-and @mymath{(0, ..., 2^{32}-1)} respectively. When the context of your work
-doesn't involve integer numbers (for example labeled images, where pixels
-can only have positive integers), it is best to use the @code{unsigned}
-types.
-
-The second standard of converting a given number of bits to numbers is the
-floating point standard, this standard can approximately store any real
-number with a given precision. There are two floating point types in
-CFITSIO: @code{float} and @code{double}, for single and double precision
-floating point numbers. The former is sufficient for data with less than 8
-significant decimal digits (most astronomical data), while the latter is
-good for less than 16 significant decimal digits. The representation of
-real numbers as bits is much more complex than integers, so we won't
-explain any further, if you are interested have a look in the
address@hidden://en.wikipedia.org/wiki/Floating_point, Wikipedia}.
address@hidden bitnot
+Bitwise not (more formally known as one's complement) operator: flip all
+the bits of the popped operand (note that this is the only unary, or single
+operand, bitwise operator). In other words, any bit with a value of
address@hidden is changed to @code{1} and vice-versa. For example (assuming
+numbers can be written as bit strings on the command-line): @code{00101000
+bitnot} will give @code{11010111}. Note that the bitwise operators only
+work on integer type datasets/numbers.
 
-With the conversion operators in Gnuastro's Arithmetic, you can change the
-types of data to each other, which is necessary in some contexts. For
-example your program/library only accepts integer values for some
-operation, but you have a floating point image. Another example can be that
-you know that your data only has values that fit within @code{char} or
address@hidden types, however the current image format is
address@hidden Operations involving floating point or larger integer types
-are significantly slower than integer or smaller types respectively. In the
-latter case, it also requires more space to keep. So when you confront such
-situations and want to store/archive/process the data, it is best to use
-Arithmetic to convert them to the most efficient type.
address@hidden uchar
+Convert the type of the popped operand to @code{unsigned char}. See
address@hidden types} for a short review of the different data types.
 
 @item char
-Convert the type of the popped operand to @code{char}. See explanations
-under the @command{unsigned char} operator for more.
+Convert the type of the popped operand to @code{char}. See @ref{Data types}
+for a short review of the different data types.
 
 @item ushort
 Convert the type of the popped operand to @code{unsigned short}. See
-explanations under the @command{unsigned char} operator for more.
address@hidden types} for a short review of the different data types.
 
 @item short
-Convert the type of the popped operand to @code{short}. See explanations
-under the @command{unsigned char} operator for more.
+Convert the type of the popped operand to @code{short}. See @ref{Data
+types} for a short review of the different data types.
 
 @item ulong
 Convert the type of the popped operand to @code{unsigned long}. See
-explanations under the @command{unsigned char} operator for more.
address@hidden types} for a short review of the different data types.
 
 @item long
-Convert the type of the popped operand to @code{long}. See explanations
-under the @command{unsigned char} operator for more.
+Convert the type of the popped operand to @code{long}. See @ref{Data types}
+for a short review of the different data types.
 
 @item longlong
 Convert the type of the popped operand to @code{long long} (64-bit
-integer). See explanations under the @command{unsigned char} operator for
-more.
+integer). See @ref{Data types} for a short review of the different data
+types.
 
 @item float
 Convert the type of the popped operand to @code{float} (single precision
-floating point). See explanations under the @command{unsigned char}
-operator for more.
+floating point). See @ref{Data types} for a short review of the different
+data types.
 
 @item double
 Convert the type of the popped operand to @code{double} (double precision
-floating point). See explanations under the @command{unsigned char}
-operator for more.
+floating point). See @ref{Data types} for a short review of the different
+data types.
 
 @end table
 
 @cartouche
 @noindent
address@hidden reminder for multiplication:} please quote the
address@hidden sign (for example, @command{"*"} or
address@hidden'*'}). Without quotation, the shell will replace @command{*}
-with a list of all the files in your working directory which can
-produce unpredictable outputs. In any case, the input images are not
-affected, they are only read.
address@hidden cartouche
-
address@hidden
address@hidden
 @strong{Blank pixels in Arithmetic:} Currently all Arithmetic operations
 are internally done in double precision floating points. So all blank
 pixels in the image (see @ref{Blank pixels}) will be stored as IEEE NaN
@@ -7474,12 +7507,31 @@ $ astarithmetic 1 image.fits / --out=inverse.fits
 $ astarithmetic image.fits -1 "*" --out=negative.fits
 $ astarithmetic image.fits image.fits - --out=skysub.fits           \
                 --hdu=0 --hdu=3
-$ astarithmetic image1.fits image2.fits + 2 / --out=average.fits
+$ astarithmetic image1.fits image2.fits + 2f / --out=average.fits
 $ astarithmetic image1.fits image2.fits average --out=average.fits
 $ astarithmetic img1.fits img2.fits img3.fits median                \
                 -h0 -h1 -h2 --out=median.fits
 @end example
 
+Arithmetic accepts two kinds of input: images and numbers. Images are
+considered to be any of the inputs that is a file name of a recognized type
+(see @ref{Arguments}). Numbers will be read into the smallest type that can
+store them, so @command{-2} will be read as a @code{char} type (which is
+signed on most systems and can thus keep negative values), @command{2500}
+will be read as an @code{unsigned short} (all positive numbers will be read
+as unsigned), while @code{3.14159265358979323846} will be read as a
address@hidden and @code{3.14} will be read as a @code{float}.
+
+All the operators will work on the native type of their operands, so the C
+programming language's internal type conversion will be used if the operand
+types of of multi-operand operators are different. Some operators can only
+work on integral types (for example bitwise operators) while others only
+work on floating point types, (for example @command{log}, or
address@hidden). In such cases if the operand type is different an error
+will be printed. Arithmetic also comes with internal type conversion
+operators which you can use to convert the data into the appropriate
+format, see @ref{Arithmetic operators}.
+
 If the output is an image, and the @option{--output} option is not
 given, automatic output will use the name of the first FITS image
 encountered to generate an output file name, see @ref{Automatic
@@ -7489,24 +7541,12 @@ will be printed in the standard output. See 
@ref{Reverse polish
 notation} for the notation used to mix operands and operators on the
 command-line.
 
address@hidden NaN
 @cindex Mask image
-Currently Arithmetic will convert the input image into double
-precision floating point arrays for the operations. But there are
-plans to allow it to also operate on integer (labeled or masked)
-images with bit-wise operators so mask layers can also be
address@hidden@url{https://savannah.gnu.org/task/?13869}}. Unless
-otherwise stated for each operator, blank pixels in the input image
-will automatically be set as blank in the output. To ignore certain
-pixels (see @ref{Blank pixels}), you can specify a mask image, see
address@hidden image}. In that case, when reading the first FITS image, all
-the masked pixels will be changed to a NaN value. Therefore in any
-further operations with other images, the output for those pixels will
-always be a NaN (blank pixel value for floating point data
-type). Currently all the operations in Arithmetic are done in double
-precision floating point type. However, if none of the input images
-have this type, the output will be stored as a single precision
-floating point type.
+All the operators will work on the native types of the input data. Unless
+otherwise stated for each operator. To ignore certain pixels (see
address@hidden pixels}), you can specify a mask image, see @ref{Mask image}. In
+that case, when reading the first FITS image, all the masked pixels will be
+set to a blank value depending on the type of the image.
 
 @cindex Options
 The hyphen (@command{-}) can be used both to specify options (see
diff --git a/lib/data-arithmetic-onlyint.c b/lib/data-arithmetic-onlyint.c
index 9f617a9..63ab16e 100644
--- a/lib/data-arithmetic-onlyint.c
+++ b/lib/data-arithmetic-onlyint.c
@@ -661,3 +661,72 @@ data_arithmetic_onlyint_binary(int operator, unsigned char 
flags,
   /* Return */
   return o;
 }
+
+
+
+
+
+gal_data_t *
+data_arithmetic_bitwise_not(int operator, unsigned char flags,
+                            gal_data_t *in)
+{
+  gal_data_t *o;
+  unsigned char    *iuc=in->array, *iucf=in->array+in->size, *ouc;
+  char              *ic=in->array,  *icf=in->array+in->size,  *oc;
+  unsigned short   *ius=in->array, *iusf=in->array+in->size, *ous;
+  short             *is=in->array,  *isf=in->array+in->size,  *os;
+  unsigned int     *iui=in->array, *iuif=in->array+in->size, *oui;
+  int               *ii=in->array,  *iif=in->array+in->size,  *oi;
+  unsigned long    *iul=in->array, *iulf=in->array+in->size, *oul;
+  long              *il=in->array,  *ilf=in->array+in->size,  *ol;
+  LONGLONG          *iL=in->array,  *iLf=in->array+in->size,  *oL;
+
+  /* If we want inplace output, set the output pointer to the input
+     pointer, for every pixel, the operation will be independent. */
+  if(flags & GAL_DATA_ARITH_INPLACE)
+    o = in;
+  else
+    o = gal_data_alloc(NULL, in->type, in->ndim, in->dsize, in->wcs,
+                       0, in->minmapsize);
+
+  /* Start setting the operator and operands. */
+  switch(in->type)
+    {
+    case GAL_DATA_TYPE_UCHAR:
+      ouc=o->array;   do *ouc++ = ~(*iuc++);  while(iuc<iucf);
+    case GAL_DATA_TYPE_CHAR:
+      oc=o->array;    do  *oc++ = ~(*ic++);   while(ic<icf);
+    case GAL_DATA_TYPE_USHORT:
+      ous=o->array;   do *ous++ = ~(*ius++);  while(ius<iusf);
+    case GAL_DATA_TYPE_SHORT:
+      os=o->array;    do  *os++ = ~(*is++);   while(is<isf);
+    case GAL_DATA_TYPE_UINT:
+      oui=o->array;   do *oui++ = ~(*iui++);  while(iui<iuif);
+    case GAL_DATA_TYPE_INT:
+      oi=o->array;    do  *oi++ = ~(*ii++);   while(ii<iif);
+    case GAL_DATA_TYPE_ULONG:
+      oul=o->array;   do *oul++ = ~(*iul++);  while(iul<iulf);
+    case GAL_DATA_TYPE_LONG:
+      ol=o->array;    do  *ol++ = ~(*il++);   while(il<ilf);
+    case GAL_DATA_TYPE_LONGLONG:
+      oL=o->array;    do  *oL++ = ~(*iL++);   while(iL<iLf);
+    default:
+      error(EXIT_FAILURE, 0, "Operator code %d not recognized in "
+            "data_arithmetic_binary_function", operator);
+    }
+
+
+  /* Clean up. Note that if the input arrays can be freed, and any of right
+     or left arrays needed conversion, `UNIFUNC_CONVERT_TO_COMPILED_TYPE'
+     has already freed the input arrays, and we only have `r' and `l'
+     allocated in any case. Alternatively, when the inputs shouldn't be
+     freed, the only allocated spaces are the `r' and `l' arrays if their
+     types weren't compiled for binary operations, we can tell this from
+     the pointers: if they are different from the original pointers, they
+     were allocated. */
+  if( (flags & GAL_DATA_ARITH_FREE) && o!=in)
+    gal_data_free(in);
+
+  /* Return */
+  return o;
+}
diff --git a/lib/data-arithmetic-onlyint.h b/lib/data-arithmetic-onlyint.h
index afe255e..e1b6c24 100644
--- a/lib/data-arithmetic-onlyint.h
+++ b/lib/data-arithmetic-onlyint.h
@@ -28,5 +28,7 @@ gal_data_t *
 data_arithmetic_onlyint_binary(int operator, unsigned char flags,
                                gal_data_t *lo, gal_data_t *ro);
 
-
+gal_data_t *
+data_arithmetic_bitwise_not(int operator, unsigned char flags,
+                            gal_data_t *in);
 #endif
diff --git a/lib/data-arithmetic-other.h b/lib/data-arithmetic-other.h
index f437e98..2281bba 100644
--- a/lib/data-arithmetic-other.h
+++ b/lib/data-arithmetic-other.h
@@ -20,8 +20,8 @@ General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 **********************************************************************/
-#ifndef __GAL_ARITHMETIC_UNARY_H__
-#define __GAL_ARITHMETIC_UNARY_H__
+#ifndef __GAL_ARITHMETIC_OTHER_H__
+#define __GAL_ARITHMETIC_OTHER_H__
 
 gal_data_t *
 data_arithmetic_change_type(gal_data_t *data, int operator,
diff --git a/lib/data.c b/lib/data.c
index 996b553..19e0fd3 100644
--- a/lib/data.c
+++ b/lib/data.c
@@ -384,6 +384,7 @@ gal_data_alloc(void *array, int type, size_t ndim, long 
*dsize,
   /* Set the basic information we know so far. Note that we need a blank
      WCS structure allocated outside of WCSLIB, then WCSLIB will copy the
      contents. */
+  out->next=NULL;
   out->ndim=ndim;
   out->type=type;
   out->minmapsize=minmapsize;
@@ -1482,7 +1483,7 @@ gal_data_operator_string(int operator)
     case GAL_DATA_OPERATOR_BITXOR:       return "bitxor";
     case GAL_DATA_OPERATOR_BITLSH:       return "lshift";
     case GAL_DATA_OPERATOR_BITRSH:       return "rshift";
-    case GAL_DATA_OPERATOR_BITOCM:       return "bitocm";
+    case GAL_DATA_OPERATOR_BITNOT:       return "bitnot";
 
     case GAL_DATA_OPERATOR_ABS:          return "abs";
     case GAL_DATA_OPERATOR_POW:          return "pow";
diff --git a/lib/gnuastro/data.h b/lib/gnuastro/data.h
index 5e07f90..ff84635 100644
--- a/lib/gnuastro/data.h
+++ b/lib/gnuastro/data.h
@@ -166,7 +166,7 @@ enum gal_data_operators
   GAL_DATA_OPERATOR_BITXOR,       /*   ^     */
   GAL_DATA_OPERATOR_BITLSH,       /*   <<    */
   GAL_DATA_OPERATOR_BITRSH,       /*   >>    */
-  GAL_DATA_OPERATOR_BITOCM,       /*   ~     */
+  GAL_DATA_OPERATOR_BITNOT,       /*   ~     */
 
   GAL_DATA_OPERATOR_ABS,          /* abs()   */
   GAL_DATA_OPERATOR_POW,          /* pow()   */
@@ -216,17 +216,18 @@ enum gal_data_operators
 
     - The `dsize' array is in the `long' type because CFITSIO uses the long
       type and this will make it easier to call CFITSIO functions.*/
-typedef struct
+typedef struct gal_data_t
 {
-  void        *array;  /* Array keeping data elements.               */
-  int           type;  /* Type of data (from `gal_data_alltypes').   */
-  size_t        ndim;  /* Number of dimensions in the array.         */
-  long        *dsize;  /* Size of array along each dimension.        */
-  size_t        size;  /* Total number of data-elements.             */
-  char     *mmapname;  /* File name of the mmap.                     */
-  size_t  minmapsize;  /* Minimum number of bytes to mmap the array. */
-  int           nwcs;  /* for WCSLIB: no. coord. representations.    */
-  struct wcsprm *wcs;  /* WCS information for this dataset.          */
+  void             *array;  /* Array keeping data elements.               */
+  int                type;  /* Type of data (from `gal_data_alltypes').   */
+  size_t             ndim;  /* Number of dimensions in the array.         */
+  long             *dsize;  /* Size of array along each dimension.        */
+  size_t             size;  /* Total number of data-elements.             */
+  char          *mmapname;  /* File name of the mmap.                     */
+  size_t       minmapsize;  /* Minimum number of bytes to mmap the array. */
+  int                nwcs;  /* for WCSLIB: no. coord. representations.    */
+  struct wcsprm      *wcs;  /* WCS information for this dataset.          */
+  struct gal_data_t *next;  /* To use it as a linked list if necessary.   */
 } gal_data_t;
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]