(file) Return to sw_functions.c CVS log (file) (dir) Up to [Development] / JSOC / proj / sharp / apps

Diff for /JSOC/proj/sharp/apps/sw_functions.c between version 1.21 and 1.25

version 1.21, 2013/11/11 23:18:40 version 1.25, 2014/02/18 23:35:03
Line 1027  int computeShearAngle(float *bx_err, flo
Line 1027  int computeShearAngle(float *bx_err, flo
         /* The area here is a fractional area -- the % of the total area. This has no error associated with it. */         /* The area here is a fractional area -- the % of the total area. This has no error associated with it. */
         *area_w_shear_gt_45ptr   = (count_mask/(count))*(100.0);         *area_w_shear_gt_45ptr   = (count_mask/(count))*(100.0);
  
         printf("MEANSHR=%f\n",*meanshear_angleptr);          //printf("MEANSHR=%f\n",*meanshear_angleptr);
         printf("MEANSHR_err=%f\n",*meanshear_angle_err_ptr);          //printf("MEANSHR_err=%f\n",*meanshear_angle_err_ptr);
         printf("SHRGT45=%f\n",*area_w_shear_gt_45ptr);          //printf("SHRGT45=%f\n",*area_w_shear_gt_45ptr);
   
           return 0;
   }
   
   /*===========================================*/
   int computeR(float *bz_err, float *los, int *dims, float *Rparam, float cdelt1,
                float *rim, float *p1p0, float *p1n0, float *p1p, float *p1n, float *p1,
                float *pmap, int nx1, int ny1)
   {
   
       int nx = dims[0];
       int ny = dims[1];
       int i = 0;
       int j = 0;
       int index;
       double sum = 0.0;
       double err = 0.0;
       *Rparam = 0.0;
       struct fresize_struct fresboxcar, fresgauss;
       int scale = round(2.0/cdelt1);
       float sigma = 10.0/2.3548;
   
       init_fresize_boxcar(&fresboxcar,1,1);
   
       // set up convolution kernel
       init_fresize_gaussian(&fresgauss,sigma,20,1);
   
       // make sure convolution kernel is smaller than or equal to array size
        if ( (nx  < 41.) || (ny < 41.) ) return -1;
   
       fsample(los, rim, nx, ny, nx, nx1, ny1, nx1, scale, 0, 0, 0.0);
       for (i = 0; i < nx1; i++)
       {
         for (j = 0; j < ny1; j++)
         {
           index = j * nx1 + i;
           if (rim[index] > 150)
             p1p0[index]=1.0;
           else
             p1p0[index]=0.0;
           if (rim[index] < -150)
             p1n0[index]=1.0;
           else
             p1n0[index]=0.0;
         }
       }
   
       fresize(&fresboxcar, p1p0, p1p, nx1, ny1, nx1, nx1, ny1, nx1, 0, 0, 0.0);
       fresize(&fresboxcar, p1n0, p1n, nx1, ny1, nx1, nx1, ny1, nx1, 0, 0, 0.0);
   
       for (i = 0; i < nx1; i++)
       {
         for (j = 0; j < ny1; j++)
         {
           index = j * nx1 + i;
           if (p1p[index] > 0 && p1n[index] > 0)
             p1[index]=1.0;
           else
             p1[index]=0.0;
         }
       }
   
       fresize(&fresgauss, p1, pmap, nx1, ny1, nx1, nx1, ny1, nx1, 0, 0, 0.0);
   
       for (i = 0; i < nx1; i++)
       {
         for (j = 0; j < ny1; j++)
         {
           index = j * nx1 + i;
           sum += pmap[index]*abs(rim[index]);
         }
       }
   
       if (sum < 1.0)
         *Rparam = 0.0;
       else
         *Rparam = log10(sum);
   
       free_fresize(&fresboxcar);
       free_fresize(&fresgauss);
  
         return 0;         return 0;
 } }


Legend:
Removed from v.1.21  
changed lines
  Added in v.1.25

Karen Tian
Powered by
ViewCVS 0.9.4