SINFONI Pipeline Reference Manual  2.5.2
sinfo_new_cubes_coadd.c
1 /*
2  * This file is part of the ESO SINFONI Pipeline
3  * Copyright (C) 2004,2005 European Southern Observatory
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
18  */
19 /*----------------------------------------------------------------------------
20 
21 File name : sinfo_new_cubes_coadd.c
22 Author : J. Schreiber
23 Created on : December 3, 2003
24 Description : Creates data cubes or merges data cubes
25 out of jittered object-sky
26 nodding observations
27 ---------------------------------------------------------------------------*/
28 #ifdef HAVE_CONFIG_H
29 # include <config.h>
30 #endif
31 
32 /*----------------------------------------------------------------------------
33  Includes
34  ---------------------------------------------------------------------------*/
35 #include "sinfo_new_cubes_coadd.h"
36 #include "sinfo_pfits.h"
37 #include "sinfo_baryvel.h"
38 #include "sinfo_pro_save.h"
39 #include "sinfo_objnod_ini_by_cpl.h"
40 #include "sinfo_functions.h"
41 #include "sinfo_utilities_scired.h"
42 #include "sinfo_wave_calibration.h"
43 #include "sinfo_cube_construct.h"
44 #include "sinfo_error.h"
45 #include "sinfo_utils_wrappers.h"
46 //Used only for sinfo_propertylist_has
47 #include "sinfo_dfs.h"
48 /*----------------------------------------------------------------------------
49  Defines
50  ---------------------------------------------------------------------------*/
51 #define PI_NUMB (3.1415926535897932384626433832795) /* pi */
52 
53 
54 /*----------------------------------------------------------------------------
55  Function Definitions
56  ---------------------------------------------------------------------------*/
57 
66 /*----------------------------------------------------------------------------
67  Function : sinfo_new_cubes_coadd()
68  In : ini_file: file name of according .ini file
69  Out : integer (0 if it worked, -1 if it doesn't)
70  Job : this routine carries through the data cube creation of an
71  object science observation using object-sky nodding
72  and jittering. This script expects jittered frames that
73  were already sky-subtracted
74  averaged, flatfielded, spectral tilt corrected and
75  interleaved if necessary
76  ---------------------------------------------------------------------------*/
77 int
78 sinfo_new_cubes_coadd (const char* plugin_id,cpl_parameterlist* config,
79  cpl_frameset* sof, const char* procatg)
80 {
81 
82  object_config * cfg=NULL ;
83  cpl_image * im=NULL ;
84  cpl_image* jitter_image=NULL;
85  cpl_imagelist ** cube_tmp=NULL ;
86 
87  cpl_imagelist ** cubeobject=NULL ;
88  cpl_imagelist * jittercube=NULL ;
89  cpl_imagelist * maskcube=NULL ;
90  cpl_propertylist* plist=NULL;
91  int sky_cor=0;
92  int pdensity=0;
93 
94  int i=0;
95  int n=0 ;
96  /* int partind = 0 ; */
97  int centralpix=0 ;
98  int z_siz=0;
99  int z_min=0;
100  int z_max=0;
101  int z=0;
102  int z_stp=100;
103  int scales_sky=0;
104  int ks_clip=0;
105  double kappa=2.0;
106 
107  float ref_offx=0;
108  float ref_offy=0;
109  float newcenter_x=0 ;
110  float newcenter_y=0 ;
111  /*
112  float cd1_1=0;
113  float cd1_2=0;
114  float cd2_1=0;
115  float cd2_2=0;
116  double pixelscale=0;
117  */
118  //double angle=0;
119  //float radangle=0 ;
120  double exptime=0 ;
121 
122  double * times=NULL ;
123  float * offsetx=NULL;
124  float * offsety=NULL;
125  float offx_min=1.e10;
126  float offy_min=1.e10;
127  float offx_max=-1.e10;
128  float offy_max=-1.e10;
129 
130  double dis=0 ;
131  double centralLambda=0 ;
132  double mjd_obs=0;
133 
134  char name_jitter[MAX_NAME_SIZE] ;
135  char pro_mjit[MAX_NAME_SIZE];
136  char pro_obs[MAX_NAME_SIZE];
137  char pro_med[MAX_NAME_SIZE];
138 
139 
140  char * name=NULL ;
141  char * partname=NULL;
142  /* char * partname2=NULL ; */
143  char file_name[MAX_NAME_SIZE];
144  int vllx=0;
145  int vlly=0;
146  int vurx=0;
147  int vury=0;
148 
149  int onp=0;
150  int j=0;
151  cpl_image* j_img=NULL;
152  cpl_image* m_img=NULL;
153  cpl_table* qclog_tbl=NULL;
154  cpl_image* ill_cor=NULL;
155  cpl_frame* frame=NULL;
156  cpl_frameset* stk=NULL;
157  cpl_parameter* p=NULL;
158  int mosaic_max_size=0;
159  double barycor=0;
160  double helicor=0;
161  cpl_table* qclog=NULL;
162 
163  check_nomsg(p=cpl_parameterlist_find(config,
164  "sinfoni.objnod.mosaic_max_size"));
165  check_nomsg(mosaic_max_size=cpl_parameter_get_int(p));
166  check_nomsg(p=cpl_parameterlist_find(config,"sinfoni.product.density"));
167  check_nomsg(pdensity=cpl_parameter_get_int(p));
168 
169  if (strcmp(procatg,PRO_COADD_STD) == 0) {
170  strcpy(pro_mjit,PRO_MASK_COADD_STD);
171  strcpy(pro_obs,PRO_OBS_STD);
172  strcpy(pro_med,PRO_MED_COADD_STD);
173 
174  } else if (strcmp(procatg,PRO_COADD_PSF) == 0) {
175  strcpy(pro_mjit,PRO_MASK_COADD_PSF);
176  strcpy(pro_obs,PRO_OBS_PSF);
177  strcpy(pro_med,PRO_MED_COADD_PSF);
178  } else {
179  strcpy(pro_mjit,PRO_MASK_COADD_OBJ);
180  strcpy(pro_obs,PRO_OBS_OBJ);
181  strcpy(pro_med,PRO_MED_COADD_OBJ);
182  }
183 
184  /*----parse input data and parameters to set cube_config cfg---*/
185  check_nomsg(stk = cpl_frameset_new());
186 
187  cknull(cfg = sinfo_parse_cpl_input_objnod(config,sof,&stk),
188  "Error setting parameter configuration");
189 
190  ck0(sinfo_check_input_data(cfg),"error checking input");
191 
192  if ( cfg->jitterind == 1 )
193  {
194  cknull(times = (double*) cpl_calloc (cfg->nframes, sizeof (double)),
195  " could not allocate memory!") ;
196 
197  cknull(offsetx = (float*) cpl_calloc (cfg->nframes, sizeof(float)),
198  " could not allocate memory!") ;
199 
200  cknull(offsety = (float*) cpl_calloc (cfg->nframes, sizeof(float)),
201  " could not allocate memory!") ;
202  }
203 
204  if (cfg->jitterind == 0)
205  {
206  if ( NULL != (partname = strtok(cfg->outName, ".")))
207  {
208  /* partname2 = strtok (NULL, ".") ; */
209  /* partind = 1 ; */
210  }
211  }
212 
213  ck0(sinfo_auto_size_cube5(cfg,&ref_offx,&ref_offy,
214  &offx_min,&offy_min,
215  &offx_max,&offy_max),
216  "Error resizing cube");
217 
218  if(NULL != cpl_frameset_find(sof,PRO_ILL_COR)) {
219  frame = cpl_frameset_find(sof,PRO_ILL_COR);
220  ill_cor=cpl_image_load(cpl_frame_get_filename(frame),CPL_TYPE_FLOAT,0,0);
221  } else {
222  sinfo_msg("Illumination correction image not provided");
223  cpl_error_reset();
224  }
225 
226  for ( n = 0 ; n < cfg->nframes ; n++ )
227  {
228 
229  sinfo_msg_debug("Read FITS information");
230  name = cfg->framelist[n] ;
231  if (n == 0)
232  {
233  strcpy (name_jitter, name) ;
234  }
235  if( sinfo_is_fits_file(name) != 1) {
236  sinfo_msg_error("Input file %s is not FITS",name);
237  goto cleanup;
238  }
239 
240 
241  /* get some header values and compute the CD-sinfo_matrix */
242  plist=cpl_propertylist_load(name,0);
243 
244  if (sinfo_propertylist_has(plist, KEY_NAME_MJD_OBS)) {
245  mjd_obs=cpl_propertylist_get_double(plist, KEY_NAME_MJD_OBS);
246  } else {
247  sinfo_msg_error("keyword %s does not exist",KEY_NAME_MJD_OBS);
248  cpl_propertylist_delete(plist) ;
249  return -1;
250  }
251 
252 
253  //pixelscale = sinfo_pfits_get_pixscale(plist) /2;
254  //angle = sinfo_pfits_get_posangle(plist) ;
255  /* in PUPIL data there is not posangle info: we reset the error */
256  if(cpl_error_get_code() != CPL_ERROR_NONE) {
257  cpl_error_reset();
258  }
259 
260  sinfo_free_propertylist(&plist);
261  // The following 5 lines are not really used here!
262  /*
263  radangle = angle * PI_NUMB / 180. ;
264  cd1_1 = cos(radangle) ;
265  cd1_2 = sin(radangle) ;
266  cd2_1 = -sin(radangle) ;
267  cd2_2 = cos(radangle) ;
268  */
269 
270  sinfo_msg_debug("frame no.: %d, name: %s\n", n, name) ;
271  cknull(im = cpl_image_load(name,CPL_TYPE_FLOAT,0,0),
272  " could not load frame %s!",name) ;
273 
274  if (cfg->jitterind == 1)
275  {
276  exptime = sinfo_pfits_get_ditndit(name) ;
277 
278  if (exptime == FLAG)
279  {
280  sinfo_msg_error("could not read fits header keyword exptime!");
281  goto cleanup;
282  }
283  times[n] = exptime ;
284 
285  ck0(sinfo_new_assign_offset(n,name,offsetx,offsety,
286  ref_offx,ref_offy),
287  "Error assigning offsets");
288 
289  }
290  sinfo_free_image(&im);
291 
292  } /* end loop over n (nframes) */
293 
294 
295  /* leak free */
296  if(cfg->jitterind == 0) {
297  goto exit;
298  }
299 
300  /* Here in case of autojitter we estimate the sky */
301  if( (cfg->size_x*cfg->size_y*cfg->nframes) > (100*mosaic_max_size) ) {
302  sinfo_msg_warning("Coadd cube size:%d,%d. N frames: %d",
303  cfg->size_x,cfg->size_y,cfg->nframes);
304  sinfo_msg_warning("Max allowed should be such "
305  "that sixeX*sixeY*Nframes < 100*%d",mosaic_max_size);
306  goto exit;
307  }
308 
309  if ( cfg->jitterind == 1 )
310  {
311  check_nomsg(p = cpl_parameterlist_find(config, "sinfoni.objnod.vllx"));
312  check_nomsg(vllx = cpl_parameter_get_int(p));
313  check_nomsg(p = cpl_parameterlist_find(config, "sinfoni.objnod.vlly"));
314  check_nomsg(vlly = cpl_parameter_get_int(p));
315  check_nomsg(p = cpl_parameterlist_find(config, "sinfoni.objnod.vurx"));
316  check_nomsg(vurx = cpl_parameter_get_int(p));
317  check_nomsg(p = cpl_parameterlist_find(config, "sinfoni.objnod.vury"));
318  check_nomsg(vury = cpl_parameter_get_int(p));
319  cknull(cube_tmp = (cpl_imagelist**) cpl_calloc (cfg->nframes,
320  sizeof (cpl_imagelist*)),
321  "Could not allocate memory for cube_tmp");
322 
323 
324  cknull(cubeobject = (cpl_imagelist**) cpl_calloc (cfg->nframes,
325  sizeof (cpl_imagelist*)),
326  "Could not allocate memory for cubeobject");
327  check_nomsg(p=cpl_parameterlist_find(config,
328  "sinfoni.objnod.sky_cor"));
329  check_nomsg(sky_cor=cpl_parameter_get_bool(p));
330 
331 
332  for ( n = 0 ; n < cfg->nframes ; n++ ) {
333  if(sky_cor == 1 && (pdensity == 1 || pdensity == 3) &&
334  strcmp(cfg->sky_dist,"no_sky")!=0) {
335  sinfo_msg("load sky corrected cubes");
336 
337  snprintf(file_name,MAX_NAME_SIZE-1,"%s%2.2d%s","out_cube_obj_cor",
338  n,".fits");
339 
340  } else {
341  snprintf(file_name,MAX_NAME_SIZE-1,"%s%2.2d%s","out_cube_obj",n,
342  ".fits");
343  }
344  check_nomsg(cube_tmp[n] = cpl_imagelist_load(file_name,
345  CPL_TYPE_FLOAT,0));
346 
347 
348  check_nomsg(cubeobject[n] = sinfo_new_cube_getvig(
349  cube_tmp[n],
350  1+vllx,1+vlly,
351  64 - vurx, 64 - vury));
352  check_nomsg(sinfo_free_imagelist(&cube_tmp[n]));
353 
354  }
355  sinfo_free_array_imagelist(&cube_tmp);
356 
357 
358  }
359 
360 
361  /*
362  ---------------------------------------------------------------------
363  ------------------------JITTERING------------------------------------
364  ---------------------------------------------------------------------
365  */
366 
367  if (cfg->jitterind == 1)
368  {
369  sinfo_msg("Jittering...");
370 
371  sinfo_msg("Coadded cube size. x: %d y: %d",
372  cfg->size_x,cfg->size_y);
373  check_nomsg(jittercube = cpl_imagelist_new()) ;
374 
375 
376  /*
377  ---------------------------------------------------------------------
378  -------------------THOMAS ALGORITHM----------------------------------
379  ---------------------------------------------------------------------
380  */
381 
382  check_nomsg(p=cpl_parameterlist_find(config,
383  "sinfoni.objnod.scales_sky"));
384  check_nomsg(scales_sky=cpl_parameter_get_bool(p));
385  check_nomsg(p=cpl_parameterlist_find(config,"sinfoni.objnod.ks_clip"));
386  check_nomsg(ks_clip = cpl_parameter_get_bool(p));
387  check_nomsg(p=cpl_parameterlist_find(config,"sinfoni.objnod.kappa"));
388  check_nomsg(kappa = cpl_parameter_get_double(p));
389 
390 
391  if(scales_sky == 1) {
392  sinfo_msg("Subtract spatial sinfo_median to each cube plane");
393  for(n=0;n<cfg->nframes;n++) {
394  sinfo_msg("Process cube %d\n",n);
395  sinfo_new_sinfoni_correct_median_it(&(cubeobject[n]));
396  }
397  }
398 
399 
400  /* AMO CHECK */
401 
402  cknull(maskcube=cpl_imagelist_new(),"could not allocate cube!");
403 
404  /* Illumination correction */
405  if(ill_cor != NULL) {
406  for(n=0;n<cfg->nframes;n++) {
407  cpl_imagelist_divide_image(cubeobject[n],ill_cor);
408  }
409  }
410  sinfo_free_image(&ill_cor);
411 
412  sinfo_msg("Combine jittered cubes");
413 
414 
415  if(ks_clip == 1) {
416  sinfo_msg("Cube coaddition with kappa-sigma");
417  }
418  check_nomsg(onp=cpl_imagelist_get_size(cubeobject[0]));
419  for(z=0;z<onp;z+=z_stp) {
420  z_siz=(z_stp < (onp-z)) ? z_stp : (onp-z);
421  z_min=z;
422  z_max=z_min+z_siz;
423  sinfo_msg("Coadding cubes: range [%4.4d,%4.4d) of 0-%d\n",
424  z_min,z_max,onp);
425 
426  for(j=z_min;j<z_max;j++) {
427  check_nomsg(j_img=cpl_image_new(cfg->size_x,
428  cfg->size_y,CPL_TYPE_FLOAT));
429  check_nomsg(cpl_imagelist_set(jittercube,j_img,j));
430  check_nomsg(m_img = cpl_image_new(cfg->size_x,
431  cfg->size_y,CPL_TYPE_FLOAT));
432  check_nomsg(cpl_imagelist_set(maskcube,m_img,j));
433  }
434  if(ks_clip == 1) {
435  sinfo_new_combine_jittered_cubes_thomas_range(cubeobject,
436  jittercube,
437  maskcube,
438  cfg->nframes,
439  offsetx,offsety,
440  times,
441  cfg->kernel_type,
442  z_min,
443  z_max,
444  kappa);
445 
446  } else {
447  sinfo_new_combine_jittered_cubes_range(cubeobject,
448  jittercube,
449  maskcube,
450  cfg->nframes,
451  offsetx,
452  offsety,
453  times,
454  cfg->kernel_type,
455  z_min,
456  z_max) ;
457  }
458  }
459  sinfo_new_convert_0_to_ZERO_for_cubes(jittercube) ;
460 
461  if (jittercube == NULL)
462  {
463  sinfo_msg_error(" could not allocate new data cube!") ;
464  goto cleanup;
465  }
466 
467  if (maskcube == NULL)
468  {
469  sinfo_msg_error(" could not merge the jittered data cubes\n") ;
470  goto cleanup;
471  }
472 
473  for ( i = 0 ; i <cfg->nframes ; i++ ) {
474  sinfo_free_imagelist(&cubeobject[i]);
475  //sinfo_msg("offx[%d]=%f,offy[%d]=%f",i,offsetx[i],i,offsety[i]);
476  }
477  sinfo_free_array_imagelist(&cubeobject);
478 
479  //Old setting
480  //newcenter_x = cfg->size_x / 2. + 0.5 ;
481  //newcenter_y = cfg->size_y / 2. + 0.5 ;
482 
483 
484  /* new setting */
485  /*
486  sinfo_msg("offx_min=%f,offy_min=%f",offx_min,offy_min);
487  sinfo_msg("offx_max=%f,offy_max=%f",offx_max,offy_max);
488  sinfo_msg("ref_offx=%f,ref_offy=%f",ref_offx,ref_offy);
489 
490  newcenter_x=2*floor(fabs(offx_min)+0.5)+32+8;
491  newcenter_y=-2*floor(fabs(offy_max)+0.5)+32-2;
492 
493 
494  newcenter_x=cfg->size_x / 2. -offsetx[0];
495  newcenter_y=cfg->size_y / 2. -offsety[0];
496  */
497 
498 
499 
500  if (mjd_obs > 53825. ) {
501  /* April 1st 2006 */
502  newcenter_x=cfg->size_x / 2. +2*ref_offx;
503  newcenter_y=cfg->size_y / 2. +2*ref_offy;
504  } else if ((mjd_obs > 53421.58210082 ) && (mjd_obs <= 53825.)){
505  /* after detector's upgrade */
506  newcenter_x=cfg->size_x / 2. -2*ref_offx;
507  newcenter_y=cfg->size_y / 2. +2*ref_offy;
508  } else {
509  /* before detector's upgrade */
510  newcenter_x=cfg->size_x / 2. +2*ref_offx;
511  newcenter_y=cfg->size_y / 2. -2*ref_offy;
512  }
513 
514 
515  //sinfo_msg("CRPIX=%f,%f", newcenter_x, newcenter_y);
516  //newcenter_x=2*floor(fabs(ref_offx)+0.5);
517  //newcenter_y=-2*floor(fabs(ref_offy)+0.5);
518  //sinfo_msg_warning("Center image: %f %f",newcenter_x,newcenter_y);
519  cknull_nomsg(qclog = sinfo_qclog_init());
520  plist=cpl_propertylist_load(file_name,0);
521  if(sinfo_baryvel(plist, &barycor,&helicor) != CPL_ERROR_NONE) {
522  sinfo_msg_warning("Could not compute velocity corrections");
523  cpl_error_reset();
524  } else {
525 
526  check_nomsg(sinfo_qclog_add_double(qclog,
527  "QC VRAD BARYCOR",
528  barycor,
529  "Barycentric radial velocity correction ",
530  "%13.6f"));
531 
532  check_nomsg(sinfo_qclog_add_double(qclog,
533  "QC VRAD HELICOR",
534  helicor,
535  "Heliocentric radial velocity correction ",
536  "%13.6f"));
537  sinfo_msg("Barycor=%g Helicor=%g",barycor,helicor);
538 
539  sinfo_free_propertylist(&plist);
540 
541  }
542 
543  ck0(sinfo_pro_save_ims(jittercube,sof,sof,cfg->outName,
544  procatg,qclog,plugin_id,config),
545  "cannot save cube %s", cfg->outName);
546 
547  sinfo_free_table(&qclog);
548 
549  /* we need to set again the following 3 */
550  plist=cpl_propertylist_load(file_name,0);
551  dis=sinfo_pfits_get_cdelt3(plist);
552  centralLambda=sinfo_pfits_get_crval3(plist);
553  centralpix=sinfo_pfits_get_crpix3(plist);
554  sinfo_free_propertylist(&plist);
555  sinfo_new_set_wcs_cube(jittercube, cfg->outName,
556  centralLambda, dis,
557  centralpix, newcenter_x, newcenter_y);
558 
559  cknull(jitter_image = sinfo_new_median_cube(jittercube),
560  " could not do sinfo_medianCube()");
561  cknull_nomsg(qclog = sinfo_qclog_init());
562  update_bad_pixel_map(jitter_image);
563  check_nomsg(sinfo_qclog_add_double(qclog,
564  "QC FRMDIF MEANSTD",
565  cpl_image_get_mean(jitter_image),
566  "mean of the collapesd cube",
567  "%13.6f"));
568  check_nomsg(sinfo_qclog_add_double(qclog,
569  "QC FRMDIF STDEV",
570  cpl_image_get_stdev(jitter_image),
571  "standard deviation of the collapesd cube",
572  "%13.6f"));
573  ck0(sinfo_pro_save_ima(jitter_image,sof,sof,cfg->med_cube_name,
574  pro_med,qclog,plugin_id,config),
575  "cannot save ima %s", cfg->outName);
576  sinfo_free_table(&qclog);
577 
578  sinfo_new_set_wcs_image(jitter_image, cfg->med_cube_name,
579  newcenter_x,newcenter_y);
580 
581  sinfo_free_image(&jitter_image);
582 
583  ck0(sinfo_pro_save_ims(maskcube,sof,sof,cfg->maskname,
584  pro_mjit,NULL,plugin_id,config),
585  "cannot save cube %s", cfg->maskname);
586 
587  sinfo_new_set_wcs_cube(maskcube, cfg->maskname,
588  centralLambda, dis, centralpix,
589  newcenter_x, newcenter_y);
590 
591  sinfo_free_double(&times) ;
592  sinfo_free_float(&offsetx) ;
593  sinfo_free_float(&offsety) ;
594  sinfo_free_imagelist(&maskcube) ;
595  sinfo_free_imagelist(&jittercube) ;
596 
597  } /* end of jittering */
598 
599  exit:
600 
601  /* free memory */
602  sinfo_objnod_free(&cfg);
603  sinfo_free_frameset(&stk);
604  return 0;
605 
606  cleanup:
607 
608  sinfo_free_image(&jitter_image);
609  sinfo_free_imagelist(&jittercube) ;
610  sinfo_free_imagelist(&maskcube) ;
611  sinfo_free_table(&qclog);
612 
613  if(cfg != NULL) {
614  if(cube_tmp != NULL) {
615  for ( n = 0 ; n < cfg->nframes ; n++ ) {
616  sinfo_free_imagelist(&(cube_tmp[n]));
617  }
618  sinfo_free_array_imagelist(&cube_tmp);
619  }
620  if(cubeobject != NULL) {
621  for ( n = 0 ; n < cfg->nframes ; n++ ) {
622  sinfo_free_imagelist(&(cubeobject[n]));
623  }
624  sinfo_free_array_imagelist(&cubeobject);
625  }
626 
627  }
628  sinfo_free_table(&qclog_tbl);
629  sinfo_free_image(&im);
630  sinfo_free_image(&ill_cor);
631  sinfo_free_float(&offsety);
632  sinfo_free_float(&offsetx);
633  sinfo_free_double(&times);
634  sinfo_objnod_free(&cfg);
635  sinfo_free_frameset(&stk);
636 
637  if (cpl_error_get_code() != CPL_ERROR_NONE) {
638  sinfo_check_rec_status(0);
639  }
640  return -1;
641 
642 
643 
644 }
645