gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 40f0a56 013/113: Minor corrections to MakeProf


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 40f0a56 013/113: Minor corrections to MakeProfiles continued
Date: Fri, 16 Apr 2021 10:33:32 -0400 (EDT)

branch: master
commit 40f0a566a8ce5e55068cbc970e3bca5e749ff088
Author: Mohammad Akhlaghi <akhlaghi@gnu.org>
Commit: Mohammad Akhlaghi <akhlaghi@gnu.org>

    Minor corrections to MakeProfiles continued
    
    While looking into the MakeProfiles code and finalizing it, some further
    minor corrections were found to be necessary and are implemented.
---
 bin/mkprof/oneprofile.c |  9 ++++-----
 bin/mkprof/profiles.c   |  4 ++--
 bin/mkprof/ui.c         | 12 ++++++++++--
 doc/gnuastro.texi       | 12 ++++++++----
 4 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/bin/mkprof/oneprofile.c b/bin/mkprof/oneprofile.c
index 8e20236..2d6fcef 100644
--- a/bin/mkprof/oneprofile.c
+++ b/bin/mkprof/oneprofile.c
@@ -103,13 +103,12 @@ oneprofile_set_coord(struct mkonthread *mkp, size_t index)
 
 
 /* Convert cartesian coordinates to the rotated elliptical radius. See the
-   "Defining an ellipse" section of the book for the full derivation. */
+   "Defining an ellipse and ellipsoid" section of the book for the full
+   derivation. */
 static void
 oneprofile_r_el(struct mkonthread *mkp)
 {
-  /* ct: cos(theta)         st: sin(theta)
-     cp: cos(phi)           sp: sin(phi)      */
-  double Xr, Yr, Zr;                               /* Rotated x, y, z. */
+  double Xr, Yr, Zr;                   /* Rotated x, y, z. */
   double q1=mkp->q[0],   q2=mkp->q[1];
   double c1=mkp->c[0],   s1=mkp->s[0];
   double c2=mkp->c[1],   s2=mkp->s[1];
@@ -514,7 +513,7 @@ oneprofile_ispsf(uint8_t fcode)
 
 
 
-/* About the shifts on the X column and y column:*/
+/* Prepare all the parameters for any type of profile. */
 void
 oneprof_set_prof_params(struct mkonthread *mkp)
 {
diff --git a/bin/mkprof/profiles.c b/bin/mkprof/profiles.c
index b869c1e..39e38f4 100644
--- a/bin/mkprof/profiles.c
+++ b/bin/mkprof/profiles.c
@@ -52,8 +52,8 @@ profiles_radial_distance(struct mkonthread *mkp)
 
 
 
-/* The integral of the Gaussian from -inf to +inf equals the square
- root of PI. So from zero to +inf it equals half of that.*/
+/* The integral of the Gaussian from -inf to +inf equals the square root of
+   PI. So from zero to +inf it equals half of that.*/
 double
 profiles_gaussian_total(double q)
 {
diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index 43b3ef0..a9b47c5 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -164,6 +164,7 @@ ui_profile_name_write(int profile_code)
     case PROFILE_POINT:          return "point";
     case PROFILE_FLAT:           return "flat";
     case PROFILE_CIRCUMFERENCE:  return "circum";
+    case PROFILE_DISTANCE:       return "distance";
     default:
       error(EXIT_FAILURE, 0, "%s: %d not recognized as a profile code",
             __func__, profile_code);
@@ -426,7 +427,7 @@ ui_parse_kernel(struct argp_option *option, char *arg,
          are needed. */
       if( kernel->size != need )
         error_at_line(EXIT_FAILURE, 0, filename, lineno, "as a %uD kernel, "
-                      "a `%s' profile needs %zu parameters, but only %zu "
+                      "a `%s' profile needs %zu parameters, but %zu "
                       "parameter%s given to `--kernel'", kernel->flag,
                       ui_profile_name_write(kernel->status), need,
                       kernel->size, kernel->size>1?"s are":" is");
@@ -1344,7 +1345,7 @@ ui_prepare_canvas(struct mkprofparams *p)
 {
   float *f, *ff;
   gal_data_t *keysll;
-  long width[2]={1,1};
+  long width[3]={1,1,1};
   int status=0, setshift=0;
   double truncr, semiaxes[3], euler_deg[3];
   size_t i, nshift=0, *dsize=NULL, ndim_counter;
@@ -1478,6 +1479,7 @@ ui_prepare_canvas(struct mkprofparams *p)
                 {
                   p->shift[0]  = (width[0]/2)*p->oversample;
                   p->shift[1]  = (width[1]/2)*p->oversample;
+                  if(p->ndim==3) p->shift[2] = (width[2]/2)*p->oversample;
                 }
             }
         }
@@ -1557,6 +1559,12 @@ ui_finalize_coordinates(struct mkprofparams *p)
      need to change them into actual image coordinates. */
   if(p->mode==MKPROF_MODE_WCS)
     {
+      /* `gal_wcs_world_to_img' API needs to be changed to allow any number
+         of dimensions. */
+      if(ndim!=2)
+        error(EXIT_FAILURE, 0, "%s: conversion from WCS coordinates is not "
+              "yet implemented for %zu dimensions", __func__, ndim);
+
       /* Note that we read the RA and Dec columns into the `p->x' and `p->y'
          arrays temporarily before. Here, we will convert them, free the old
          ones and replace them with the proper X and Y values. */
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 194eb85..1b41a40 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -14911,14 +14911,18 @@ value will be used for all pixels between the 
truncation radius
 (@mymath{r_t}) and @mymath{r_t-w} (@mymath{w} is the value to the
 @option{--circumwidth}).
 @item
+@item
 Radial distance profile with `@code{distance}' or `@code{7}'. At the lowest
 level, each pixel only has an elliptical radial distance given the
 profile's shape and orentiation (see @ref{Defining an ellipse and
 ellipsoid}). When this profile is chosen, the pixel's elliptical radial
-distance from the profile center is written as its value. You can use this
-to define your own higher-level radial function. Note that for this
-profile, the value in the magnitude column (@option{--mcol}) will be
-ignored.
+distance from the profile center is written as its value. For this profile,
+the value in the magnitude column (@option{--mcol}) will be ignored.
+
+You can use this for checks or as a first approximation to define your own
+higher-level radial function. In the latter case, just note that the
+central values are going to be incorrect (see @ref{Sampling from a
+function}).
 @end itemize
 
 



reply via email to

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