[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 231a69e 5/6: New function to replace non-NaN p
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 231a69e 5/6: New function to replace non-NaN pixels in arraymanip |
Date: |
Fri, 12 Aug 2016 23:58:02 +0000 (UTC) |
branch: master
commit 231a69e62ac94181d5a0c80deffadb541a4c68cc
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
New function to replace non-NaN pixels in arraymanip
A new function was added to `lib/arraymanip.c' to replace non-NaN pixels in
an array with a given value. The main purpose was for task #14116
("MakeProfiles option to set non-masked pixels in background image to
zero").
Also one indentation case was corrected in fits.c
---
lib/arraymanip.c | 14 ++++++++++++++
lib/fits.c | 2 +-
lib/gnuastro/arraymanip.h | 3 +++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/lib/arraymanip.c b/lib/arraymanip.c
index ac5e62c..419f880 100644
--- a/lib/arraymanip.c
+++ b/lib/arraymanip.c
@@ -206,6 +206,20 @@ gal_arraymanip_freplace_value(float *in, size_t size,
float from, float to)
+/* Only replace non-NaN values in a float array. */
+void
+gal_arraymanip_freplace_nonnans(float *in, size_t size, float to)
+{
+ float *fpt;
+ fpt=in+size;
+ do
+ *in = isnan(*in) ? *in : to;
+ while(++in<fpt);
+}
+
+
+
+
/* Move all the non-NaN elements in the array to the start of the
array so that the non-NaN alements are contiguous. This is useful
diff --git a/lib/fits.c b/lib/fits.c
index 538e248..a48cfb7 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -734,7 +734,7 @@ hdutypestring(int hdutype)
desired type. */
void
gal_fits_read_hdu(char *filename, char *hdu, int desiredtype,
- fitsfile **outfptr)
+ fitsfile **outfptr)
{
size_t len;
char *ffname;
diff --git a/lib/gnuastro/arraymanip.h b/lib/gnuastro/arraymanip.h
index 761c4d7..69765f4 100644
--- a/lib/gnuastro/arraymanip.h
+++ b/lib/gnuastro/arraymanip.h
@@ -51,6 +51,9 @@ void
gal_arraymanip_freplace_value(float *in, size_t size, float from, float to);
void
+gal_arraymanip_freplace_nonnans(float *in, size_t size, float to);
+
+void
gal_arraymanip_no_nans(float *in, size_t *size);
void
- [gnuastro-commits] master updated (0b9d8f0 -> 463dd0c), Mohammad Akhlaghi, 2016/08/12
- [gnuastro-commits] master 93afc48 3/6: Macro to read numbers in txtarray is now a function, Mohammad Akhlaghi, 2016/08/12
- [gnuastro-commits] master 5d17cfa 2/6: New macro to check columns for input catalogs, Mohammad Akhlaghi, 2016/08/12
- [gnuastro-commits] master 231a69e 5/6: New function to replace non-NaN pixels in arraymanip,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 0fe062a 1/6: Two indentations corrected, Mohammad Akhlaghi, 2016/08/12
- [gnuastro-commits] master 463dd0c 6/6: MakeProfiles can now use input image as canvas, Mohammad Akhlaghi, 2016/08/12
- [gnuastro-commits] master 799c83b 4/6: Flat profiles in MakeProfiles are given values, Mohammad Akhlaghi, 2016/08/12