Example #1
0
int Plot_y_errorbar (int n, float *x, float *top, float *bot, /*{{{*/
                     float terminal_length)
{
   int status = -1;

   if (pli_undefined())
     return -1;

   if (PLI->plot_y_errorbar == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: plot_y_errorbar operation is not supported");
        return -1;
     }

   SLang_start_arg_list ();
   status = push_three_float_arrays (n, x, top, bot);
   SLang_push_float (terminal_length);
   SLang_end_arg_list ();

   if ((status < 0) || (-1 == SLexecute_function (PLI->plot_y_errorbar)))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed plotting Y errorbar");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "failed plotting Y errorbar");
        return -1;
     }

   return status;
}
Example #2
0
int Plot_points (int n, float *x, float *y, int symbol) /*{{{*/
{
   int status = -1;

   if (pli_undefined())
     return -1;

   if (PLI->plot_points == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: plot_points operation is not supported");
        return -1;
     }

   SLang_start_arg_list ();
   status = push_two_float_arrays (n, x, y);
   SLang_push_integer (symbol);
   SLang_end_arg_list ();

   if ((status < 0) || (-1 == SLexecute_function (PLI->plot_points)))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed plotting points");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "failed plotting points");
        return -1;
     }

   return status;
}
Example #3
0
int _Plot_set_charsize (float size) /*{{{*/
{
   int status;

   if (pli_undefined())
     return -1;

   if (PLI->set_char_size == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: set_char_size operation is not supported");
        return -1;
     }

   SLang_start_arg_list ();
   SLang_push_float (size);
   SLang_end_arg_list ();

   if (-1 == SLexecute_function (PLI->set_char_size))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "plot: set_char_size failed");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: set_char_size failed");
        return -1;
     }

   return status;
}
Example #4
0
int Plot_select_window (int device) /*{{{*/
{
   int status;

   if (pli_undefined())
     return -1;

   if (PLI->select_window == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: select_window operation is not supported");
        return -1;
     }

   SLang_start_arg_list ();
   SLang_push_integer (device);
   SLang_end_arg_list ();

   if (-1 == SLexecute_function (PLI->select_window))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed selecting plot device");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "failed selecting plot device");
        return -1;
     }

   return status;
}
Example #5
0
int Plot_line (int n, float *x, float *y) /*{{{*/
{
   int status = -1;

   if (pli_undefined())
     return -1;

   if (PLI->plot_xy == NULL)
     return -1;

   SLang_start_arg_list ();
   status = push_two_float_arrays (n, x, y);
   SLang_end_arg_list ();

   if ((status < 0) || (-1 == SLexecute_function (PLI->plot_xy)))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed plotting line");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "failed plotting line");
        return -1;
     }

   return status;
}
Example #6
0
int Plot_open (char *device) /*{{{*/
{
   int id;

   if (pli_undefined())
     return -1;

   if (PLI->open == NULL)
     return -1;

   SLang_start_arg_list ();
   SLang_push_string (device);
   SLang_end_arg_list ();

   if (-1 == SLexecute_function (PLI->open))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed opening plot device");
        return -1;
     }

   if ((-1 == SLang_pop_integer (&id))
       || (id <= 0))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "failed opening plot device");
        return -1;
     }

   return id;
}
Example #7
0
int Plot_subdivide (int num_x_subpanels, int num_y_subpanels) /*{{{*/
{
   int status;

   if (pli_undefined())
     return -1;

   if (PLI->subdivide == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: subdivide operation is not supported");
        return -1;
     }

   SLang_start_arg_list ();
   SLang_push_integer (num_x_subpanels);
   SLang_push_integer (num_y_subpanels);
   SLang_end_arg_list ();

   if (-1 == SLexecute_function (PLI->subdivide))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed subdividing plot device");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "failed subdividing plot device");
        return -1;
     }

   return status;
}
Example #8
0
int _Plot_label_box (char *xlabel, char *ylabel, char *tlabel) /*{{{*/
{
   int status;

   if (pli_undefined())
     return -1;

   if (PLI->label_axes == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: label_axes operation is not supported");
        return -1;
     }

   SLang_start_arg_list ();
   SLang_push_string (xlabel);
   SLang_push_string (ylabel);
   SLang_push_string (tlabel);
   SLang_end_arg_list ();

   if (-1 == SLexecute_function (PLI->label_axes))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "plot: label_axes failed");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: label_axes failed");
        return -1;
     }

   return status;
}
Example #9
0
int Plot_close (void) /*{{{*/
{
   int status;
   SLSig_Fun_Type *sig_func;

   if (pli_undefined())
     return -1;

   if (PLI->close == NULL)
     return -1;

   sig_func = SLsignal (SIGSEGV, sig_segv);
   if (SIG_ERR == sig_func)
     fprintf (stderr, "warning:  failed initializing signal handler for SIGSEGV\n");

   if (-1 == SLexecute_function (PLI->close))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed closing plot device");
        return -1;
     }
   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "function closing plot device did not return status integer");
        return -1;
     }

   if (SLsignal (SIGSEGV, sig_func) == SIG_ERR)
     fprintf (stderr, "warning:  failed to re-set signal handler\n");

   return status;
}
Example #10
0
char *Plot_configure_axis (char *opt, int is_log, int has_numbers) /*{{{*/
{
   char *s;

   if (pli_undefined())
     return NULL;

   if (PLI->configure_axis == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: configure_axis operation is not supported");
        return NULL;
     }

   SLang_start_arg_list ();
   SLang_push_string (opt);
   SLang_push_integer (is_log);
   SLang_push_integer (has_numbers);
   SLang_end_arg_list ();

   if (-1 == SLexecute_function (PLI->configure_axis))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "plot: configure_axis failed");
        return NULL;
     }

   if (-1 == SLpop_string (&s))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: configure_axis failed");
        return NULL;
     }

   return s;
}
Example #11
0
static int read_plot_cursor (Cursor_Config_Type *cc, float *x, float *y, char *ch) /*{{{*/
{
   if (pli_undefined())
     return -1;

   if (PLI->read_cursor == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: read_cursor operation is not supported");
        return -1;
     }

   if (-1 == SLang_push_cstruct ((VOID_STAR)cc, Cursor_Config_Table))
     return -1;

   if (-1 == SLexecute_function (PLI->read_cursor))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "plot: read_cursor failed");
        return -1;
     }

   if (SLstack_depth() < 3)
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: read_cursor failed");
        return -1;
     }

   SLang_pop_char (ch);
   SLang_pop_float (y);
   SLang_pop_float (x);

   return 0;
}
Example #12
0
char *Plot_get_option_string_default (void) /*{{{*/
{
   char *s;

   if (pli_undefined())
     return NULL;

   if (PLI->default_axis == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: default_axis operation is not supported");
        return NULL;
     }

   if (-1 == SLexecute_function (PLI->default_axis))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "plot: default_axis failed");
        return NULL;
     }

   if (-1 == SLpop_string (&s))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: default_axis failed");
        return NULL;
     }

   return s;
}
Example #13
0
File: math.c Project: hankem/ISIS
static void _fft1d (int *isign, double *scaling) /*{{{*/
{
   SLang_Array_Type *re, *im;
   int dims;
   int ndim = 1;

   re = im = NULL;

   if (-1 == SLang_pop_array_of_type (&im, SLANG_DOUBLE_TYPE)
       || im == NULL
       || -1 == SLang_pop_array_of_type (&re, SLANG_DOUBLE_TYPE)
       || re == NULL
       || re->num_elements != im->num_elements
       || abs(*isign) != 1)
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "invalid input to FFT");
        goto push_values;
     }

   dims = (int) re->num_elements;

   if (-1 == JDMfftn (ndim, &dims, (double *)re->data,
                      (double *)im->data, *isign, *scaling))
     isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "computing FFT");

   JDMfft_free ();

   push_values:
   (void) SLang_push_array (re, 1);
   (void) SLang_push_array (im, 1);
}
Example #14
0
int Plot_histogram_data (int n, float *lo, float *hi, float *val) /*{{{*/
{
   int status = -1;

   if (pli_undefined())
     return -1;

   if (PLI->plot_histogram == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: plot_histogram operation is not supported");
        return -1;
     }

   SLang_start_arg_list ();
   status = push_three_float_arrays (n, lo, hi, val);
   SLang_end_arg_list ();

   if ((status < 0) || (-1 == SLexecute_function (PLI->plot_histogram)))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed plotting histogram");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "failed plotting histogram");
        return -1;
     }

   return status;
}
Example #15
0
int Plot_query_plot_limits (float *xmin, float *xmax, float *ymin, float *ymax) /*{{{*/
{
   if (pli_undefined())
     return -1;

   if (PLI->query_plot_limits == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: query_plot_limits operation is not supported");
        return -1;
     }

   if (-1 == SLexecute_function (PLI->query_plot_limits))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed querying plot limits");
        return -1;
     }

   if ((-1 == SLang_pop_float (ymax))
       || (-1 == SLang_pop_float (ymin))
       || (-1 == SLang_pop_float (xmax))
       || (-1 == SLang_pop_float (xmin)))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed querying plot limits");
        return -1;
     }

   return 0;
}
Example #16
0
static int compute_gainshift_kernel (Isis_Kernel_t *k, double *result, Isis_Hist_t *g, double *par, unsigned int num, /*{{{*/
                                     int (*fun)(Isis_Hist_t *))
{
   Isis_Rmf_t *rmf = k->rsp.rmf;
   double *ylo=NULL, *yhi=NULL;
   double *tmp, *shift_lo, *shift_hi;
   double r0 = par[0]/KEV_ANGSTROM, slope = par[1];
   unsigned int i, len, n;
   int status = -1;

   if (-1 == compute_kernel (k, result, g, par, num, fun))
     return -1;

   if ((par[0] < 0) || (par[1] == 0.0))
     {
        isis_vmesg(FAIL, I_ERROR, __FILE__, __LINE__,
                   "gainshift kernel:  parameters (%g, %g) define an invalid grid",
                   par[0], par[1]);
        return -1;
     }

   if (-1 == rmf->get_data_grid (rmf, &ylo, &yhi, &n, NULL))
     return -1;

   len = 3 * n * sizeof(double);
   if (NULL == (tmp = (double *) ISIS_MALLOC (len)))
     goto return_error;
   shift_lo  = tmp + n;
   shift_hi  = tmp + 2*n;

#define NEW_LAMBDA(y)    (1.0/(1.0/y/slope - r0))

   shift_lo[0] = NEW_LAMBDA(ylo[0]);
   for (i = 1; i < n; i++)
     {
        shift_lo[i] = NEW_LAMBDA(ylo[i]);
        shift_hi[i-1] = shift_lo[i];
     }
   shift_hi[n-1] = NEW_LAMBDA(yhi[n-1]);

   if (-1 == rebin_histogram (result, ylo, yhi, n,
                              tmp, shift_lo, shift_hi, n))
     {
        ISIS_FREE(tmp);
        isis_vmesg(FAIL, I_ERROR, __FILE__, __LINE__,
                   "gainshift kernel failed while rebinning histogram");
        goto return_error;
     }

   memcpy ((char *)result, (char *)tmp, n * sizeof(double));
   ISIS_FREE(tmp);

   status = 0;
   return_error:
   ISIS_FREE(ylo);
   ISIS_FREE(yhi);

   return status;
}
Example #17
0
File: math.c Project: hankem/ISIS
static void prand_array (double *rate, SLindex_Type *num) /*{{{*/
{
   SLang_Array_Type *at = NULL;
   double *ai;
   SLindex_Type i, n;

   n = *num;

   if (n == 0)
     return;
   else if (n == 1)
     {
        SLang_push_double (prand (*rate));
        return;
     }

   if (NULL == (at = SLang_create_array (SLANG_DOUBLE_TYPE, 0, NULL, &n, 1)))
     {
        isis_vmesg (INTR, I_FAILED, __FILE__, __LINE__, "creating array of random values");
        return;
     }

   ai = (double *) at->data;
   for (i = 0; i < n; i++)
     {
        ai[i] = prand (*rate);
     }

   SLang_push_array (at, 1);
}
Example #18
0
File: math.c Project: hankem/ISIS
static void rand_array (SLindex_Type num, double (*rand_fun)(void)) /*{{{*/
{
   SLang_Array_Type *at = NULL;
   double *ad;
   SLindex_Type i;

   if (num <= 0)
     return;
   else if (num == 1)
     {
        SLang_push_double ((*rand_fun)());
        return;
     }

   if (NULL == (at = SLang_create_array (SLANG_DOUBLE_TYPE, 0, NULL, &num, 1)))
     {
        isis_vmesg (INTR, I_FAILED, __FILE__, __LINE__, "creating array of random values");
        return;
     }

   ad = (double *) at->data;
   for (i = 0; i < num; i++)
     ad[i] = (*rand_fun) ();

   SLang_push_array (at, 1);
}
Example #19
0
static int get_opt_value (Isis_Option_Type *opt, char *option, char **vp)
{
   unsigned int i, num;
   char **option_names;

   if ((opt == NULL) || (option == NULL))
     return 0;

   option_names = opt->option_names;
   num = opt->num_options;

   for (i = 0; i < num; i++)
     {
        if (0 != isis_strcasecmp (option, option_names[i]))
          continue;

        if (NULL == (*vp = opt->option_values[i]))
          {
             isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "%s option %s requires a value",
                         opt->subsystem, option);
             return -1;
          }

        return 1;
     }
   return 0;
}
Example #20
0
static int set_rel_abund (Model_t *m, float metal_abund, float *rel_abund,  /*{{{*/
                          unsigned int *element, unsigned int num_rel_abund)
{
   unsigned int i, Z;

   if (NULL == m)
     return -1;

   m->rel_abund[1] = 1.0;   /* H is cosmic */
   m->rel_abund[2] = 1.0;   /* He is cosmic */

   for (Z = 3; Z <= ISIS_MAX_PROTON_NUMBER; Z++)
     m->rel_abund[Z] = metal_abund;

   if ((rel_abund == NULL) || (element == NULL))
     return 0;

   for (i = 0; i < num_rel_abund; i++)
     {
        Z = element[i];
        if (Z <= ISIS_MAX_PROTON_NUMBER)
          m->rel_abund[Z] = rel_abund[i];
        else isis_vmesg (FAIL, I_INVALID, __FILE__, __LINE__, "Z = %d", Z);
     }

   return 0;
}
Example #21
0
static int compute_flux (Isis_Kernel_t *k, double *kernel_params, unsigned int num_kernel_params, /*{{{*/
                         Isis_Hist_t *counts, double *bgd,
                         double *f, double *df, double **weights, char *options)
{
   double *cts, *ar;
   int i, n;

   (void) kernel_params; (void) num_kernel_params; (void) options;

   if (k == NULL)
     return -1;

   if (k->rsp.next != NULL)
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "flux-correction for multiple responses is not supported");
        return -1;
     }

   n = k->num_orig_data;
   cts = counts->val;

   /* Do background subtraction */

   if (bgd == NULL)
     {
        for (i = 0; i < n; i++)
          {
             f[i] = cts[i];
             /* zero is ok */
             df[i] = sqrt(fabs(cts[i]));
          }
     }
   else
     {
        for (i = 0; i < n; i++)
          {
             f[i] = cts[i] - bgd[i];
             /* zero is ok */
             df[i] = sqrt(fabs(cts[i] + bgd[i]));
          }
     }

   /* flux-correct */

   if (NULL == (ar = isis_unit_source_response (k)))
     return -1;

   for (i = 0; i < n ; i++)
     {
        if (ar[i] != 0.0)
          {
             f[i] /= ar[i];
             df[i] /= ar[i];
          }
     }

   *weights = ar;

   return 0;
}
Example #22
0
int cfits_get_colunits (char *col_units, const char *col_name, cfitsfile *fptr)
{
   int status = 0;
   int colnum;

   if (NULL == col_units || NULL == col_name || NULL == fptr)
     return -1;

   if (-1 == cfits_get_colnum (&colnum, col_name, fptr))
     return -1;

   col_units[0] = 0;

   (void) fits_get_bcolparms ((fitsfile *) fptr, colnum, NULL, col_units,
                              NULL, NULL, NULL, NULL, NULL, NULL, &status);

   cfits_report_error (status);
   if (status != 0) return -1;

   if (col_units[0] == 0)
     {
        isis_vmesg (FAIL, I_WARNING, __FILE__, __LINE__,
                    "column %d '%s' lacks a TUNIT keyword",
                    colnum, col_name);
        return -1;
     }

   return 0;
}
Example #23
0
void _add_slang_statistic (char *name) /*{{{*/
{
   if ((-1 == isis_fit_add_statistic (name, init_sl_statistic))
       || (-1 == fixup_sl_statistic_name (name)))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "adding fit statistic %s", name);
     }
}
Example #24
0
File: rmf.c Project: hankem/ISIS
static int default_factor_rsp (Isis_Rmf_t *rmf, double *arf) /*{{{*/
{
   (void) rmf; (void) arf;

   isis_vmesg (FAIL, I_NOT_IMPLEMENTED, __FILE__, __LINE__,
               "factorization is not supported for this RMF type");
   return -1;
}
Example #25
0
File: rmf.c Project: hankem/ISIS
static int default_rebin_rmf (Isis_Rmf_t *rmf, double *lo, double *hi, unsigned int num) /*{{{*/
{
   (void) rmf; (void) lo; (void) hi; (void) num;

   isis_vmesg (FAIL, I_NOT_IMPLEMENTED, __FILE__, __LINE__,
               "rebinning is not supported for this RMF type");
   return -1;
}
Example #26
0
static int pli_undefined (void) /*{{{*/
{
   if (PLI == NULL)
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__,
                    "plot interface is undefined");
        return 1;
     }
   return 0;
}
Example #27
0
File: rmf.c Project: hankem/ISIS
int Rmf_rebin_rmf (Isis_Rmf_t *rmf, double *lo, double *hi, unsigned int num) /*{{{*/
{
   int swapped;

   if ((rmf == NULL) || (lo == NULL) || (hi == NULL))
     return -1;

   if (num == 0)
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "0 bins");
        return -1;
     }

   if (rmf->ref_count > 0)
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "RMF in use, rebin failed");
        return -1;
     }

#if 1
   if (-1 == _isis_fixup_lo_hi_grids (lo, hi, num, &swapped, NULL))
     return -1;
#else
   if ((num > 1)
       && ((lo[0] >= lo[1]) || (hi[0] >= hi[1]) || (hi[0] <= lo[0])))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "grids must be in ascending order");
        return -1;
     }
#endif

   if (-1 == rmf->rebin_rmf (rmf, lo, hi, num))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "rebin failed");
        return -1;
     }

   return 0;
}
Example #28
0
int _Plot_draw_box (char *xopt, float xtick, int nxsub, /*{{{*/
                     char *yopt, float ytick, int nysub)
{
   int status;

   if (pli_undefined())
     return -1;

   if (PLI->draw_box == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: draw_box operation is not supported");
        return -1;
     }

   SLang_start_arg_list ();
   SLang_push_string (xopt);
   SLang_push_float (xtick);
   SLang_push_integer (nxsub);
   SLang_push_string (yopt);
   SLang_push_float (ytick);
   SLang_push_integer (nysub);
   SLang_end_arg_list ();

   if (-1 == SLexecute_function (PLI->draw_box))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "plot: draw_box failed");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: draw_box failed");
        return -1;
     }

   return status;
}
Example #29
0
int Plot_symbol_points (SLindex_Type n, float *x, float *y, int *symbol) /*{{{*/
{
   SLang_Array_Type *sl_sym=NULL;
   int status = -1;

   if (pli_undefined())
     return -1;

   if (PLI->plot_symbol_points == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: plot_symbol_points operation is not supported");
        return -1;
     }

   if (NULL == (sl_sym = SLang_create_array (SLANG_INT_TYPE, 0, NULL, &n, 1)))
     return -1;
   memcpy ((char *)sl_sym->data, (char *)symbol, n * sizeof(int));

   SLang_start_arg_list ();
   status = push_two_float_arrays (n, x, y);
   SLang_push_array (sl_sym, 1);
   SLang_end_arg_list ();

   if ((status < 0) || (-1 == SLexecute_function (PLI->plot_symbol_points)))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed plotting points");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "failed plotting points");
        return -1;
     }

   return status;
}
Example #30
0
File: voigt.c Project: hankem/ISIS
static int voigt (double x, double y, double *u) /*{{{*/
{
   double v;
   /* z = x + iy  =>   w(z) = u + iv */
   if (-1 == wofz (x, y, u, &v))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__,
                    "evaluating voigt function for x=%g, y=%g",
                    x, y);
        return -1;
     }

   return 0;
}