WikiStart: manipdocs.txt

File manipdocs.txt, 37.0 KB (added by pcr, 12 years ago)

documentation for data manipulation procedures

Line 
1
2----- Documentation for Manip\average_bisp.pro -----
3 NAME:
4      AVERAGE_BISP
5
6 AUTHOR:
7      pierre.cruzalebes@oca.eu
8
9 PURPOSE:
10      calculate weighted mean and stdev of specified
11      closure phase/bispectrum/triple product files of
12      different observing files (with direct bootstrap if number of files
13      ge NB_DATA_BOOT)
14
15 CATEGORY:
16      data manipulation
17
18 INPUTS:
19      need a text input file (in OBS_PATH/INP/ directory) with:
20        - number of observing block(s)
21      for each observing block:
22        - number of input file(s)
23        - input data file name(s)
24      then:
25        - if needed (default = AMBER format) : data format ('clos' or 'bisp'
26        or 'trip')
27
28 REQUIREMENTS:
29      closure phase data:
30      data read in input data file(s) (in subdirectory of OBS_PATH/)
31      must be in ASCII format and contain (in this order, one raw per spectral channel) :
32          - closure phase and err. [deg] for each observing file
33
34      bispectrum data:
35      data read in input data file(s) (in subdirectory of OBS_PATH/)
36      must be in ASCII format and contain (in this order, one raw per spectral channel) :
37        - wavelength [nm], nber of frames or weight,
38        real part of bispectrum (or bisp resp), and error,
39        imaginary part of bispectrum (or bisp resp), and error
40        ([photoel^3] or [(W/m^2/mu)^3] or [photoel^3/(W/m^2/mu)^3])
41
42      triple product data:
43      data read in input data file(s) (in subdirectory of OBS_PATH/)
44      must be in ASCII format and contain (in this order, one raw per spectral channel) :
45        - wavelength [nm], nber of frames or weight,
46        real part of triple product (or triple prod resp), and error,
47        imaginary part of triple product (or triple prod resp), and error
48
49      AMBER data (default):
50      data read in input data file(s) (in subdirectory of OBS_PATH/)
51      must be in ASCII format and contain :
52        - wavelength [nm], nber of frames or weight,
53        real part of bispectrum (or bisp resp), and error,
54        imaginary part of bispectrum (or bisp resp), and error
55        ([photoel^3] or [(W/m^2/mu)^3] or [photoel^3/(W/m^2/mu)^3]),
56        real part of triple product (or triple prod resp), and error,
57        imaginary part of triple product (or triple prod resp), and error
58
59 OUTPUTS:
60      closure phase data:
61      data written in output mean bispectral file (in the same subdirectory
62      of OBS_PATH/) are (in this order, one row per wavelength) :
63        - mean closure phase and err. [deg]
64
65      bispectrum data:
66      data written in output mean bispectral file (in the same subdirectory
67      of OBS_PATH/) are (in this order, one row per wavelength) :
68        - wavelength [nm], mean nber of frames of mean weight, real part
69        of mean bispectrum (or bisp resp), and error, imaginary part of
70        mean bispectrum (or bisp resp), and error (in [photoel^3] or
71        in [(W/m^2/mu)^3] or in [photoel^3/(W/m^2/mu)^3])
72
73      triple product data:
74      data written in output mean triple product file (in the same subdirectory
75      of OBS_PATH/) are (in this order, one row per wavelength) :
76        - wavelength [nm], mean nber of frames of mean weight, real part
77        of mean triple product (or triple prod resp), and error, imaginary part of
78        mean triple product (or triple prod resp), and error
79
80      AMBER data (default):
81      data written in output bispectral response file(s) (in the same
82      subdirectory of OBS_PATH/) are (in this order) :
83        - wavelength [nm], mean nber of frames of mean weight, real part
84        of mean bispectrum (or bisp resp), and error, imaginary part of
85        mean bispectrum (or bisp resp), and error (in [photoel^3] or
86        in [(W/m^2/mu)^3] or in [photoel^3/(W/m^2/mu)^3]), real part
87        of mean triple product (or triple prod resp), and error, imaginary part of
88        mean triple product (or triple prod resp), and error
89
90 LOCAL PROCEDURE CALLED:
91        RESET_PLOT
92
93 LOCAL FUNCTION USED:
94        COSD
95        EXTRACT_PROHEADER
96        GET_OUTLIER_FENCES
97        SIND
98        SYM
99        WAVG
100        WSTERR
101
102 LOCAL SYSTEM VARIABLE USED:
103        EPSILON
104        MAX_FLUX
105        MIN_FLUX
106        NB_BOOT_LOOPS
107        NB_DATA_BOOT
108        NB_LAMBDA_MAX
109        NB_OB_MAX
110        MAX_NDIT
111        OBS_PATH
112        PLOT_DEV
113        SPIDAST_PATH
114
115 REVISION HISTORY:
116      Written by pcr 2008/05/19
117      last modification 2010/12/26
118
119----- Documentation for Manip\average_data.pro -----
120 NAME:
121      AVERAGE_DATA
122
123 AUTHOR:
124      pierre.cruzalebes@oca.eu
125
126 PURPOSE:
127      calculate weighted mean and stdev of specified data files of different
128      observing files (with direct bootstrap if number of files ge NB_DATA_BOOT)
129
130 CATEGORY:
131      data manipulation
132
133 INPUTS:
134      need a text input file (in OBS_PATH/INP/ directory) with:
135        - number of observing block(s)
136      for each block:
137        - number of data file(s) to average
138        - data file name(s)
139      then:
140        - if needed (default = AMBER format) : data format ('vis' or 'spec'
141        or 'coh' or 'wave')
142
143 REQUIREMENTS:
144      vis data:
145      data read in input data file(s) (in subdirectory of OBS_PATH/)
146      must be in ASCII format and contain (in this order, one raw per spectral channel) :
147        - visibility (or vis response) and error for each observing file
148
149      flux data:
150      data read in input data file(s) (in subdirectory of OBS_PATH/)
151      must be in ASCII format and contain (in this order, one raw per spectral channel) :
152        - flux (or flux response) and error (fluxes [photoel] or [W/m^2/mum],
153         flux resp [photoel/(W/m^2/mum)]) for each observing file
154
155      coh flux data:
156      data read in input data file(s) (in subdirectory of OBS_PATH/)
157      must be in ASCII format and contain (in this order, one raw per spectral channel) :
158        - coherent flux (or coh flux response) and error (coh fluxes [photoel]
159         or [W/m^2/mum], coh flux resp [photoel/(W/m^2/mum)])
160         for each observing file
161
162      wavelength data:
163      data read in input data file(s) (in subdirectory of OBS_PATH/)
164      must be in ASCII format and contain (in this order, one row per wavelength) :
165        - wavelength and bandwidth for each observing file
166
167      AMBER data (default):
168      data read in input data file(s) (in subdirectory of OBS_PATH/)
169      must be in ASCII format and contain (in this order, one raw per spectral channel) :
170        - weight or nber of frames, visibility (or vis response) and
171        error, flux (or flux response) and error, coh flux (or coh flux
172        response) and error (fluxes [photoel] or [W/m^2/mum], flux resp
173        [photoel/(W/m^2/mum)])
174
175 OUTPUTS:
176      vis data:
177      data written in output mean data file(s) (in the same subdirectory
178      of OBS_PATH/) are (in this order, one row per wavelength) :
179        - mean visibility (or vis response) and error
180
181      flux data:
182      data written in output mean data file(s) (in the same subdirectory
183      of OBS_PATH/) are (in this order, one row per wavelength) :
184        - mean flux (or flux response) and error (fluxes [photoel] or
185        [W/m^2/mum], flux resp [photoel/(W/m^2/mum)])
186
187      coh flux data:
188      data written in output mean data file(s) (in the same subdirectory
189      of OBS_PATH/) are (in this order, one row per wavelength) :
190        - mean coherent flux (or coh flux response) and error
191        (coh fluxes [photoel] or [W/m^2/mum], coh flux resp
192        [photoel/(W/m^2/mum)])
193
194      wavelength data:
195      data written in output mean data file(s) (in the same subdirectory
196      of OBS_PATH/) are (in this order, one row per wavelength) :
197        - mean wavelength and mean-resolution bandwidth
198
199      AMBER data (default):
200      data written in output mean data file(s) (in the same subdirectory
201      of OBS_PATH/) are (in this order, one row per wavelength) :
202        - mean weight or mean nb of fr, mean vis (or vis response) and error,
203        mean flux (or flux response) and error, mean coh flux (or coh
204        flux response) and error (fluxes [photoel] or [W/m^2/mum], flux resp
205        [photoel/(W/m^2/mum)])
206
207 LOCAL PROCEDURE CALLED:
208        RESET_PLOT
209
210 LOCAL FUNCTION USED:
211        EXTRACT_PROHEADER
212        GET_OUTLIER_FENCES
213        SYM
214        WAVG
215        WSTERR
216
217 LOCAL SYSTEM VARIABLE USED:
218        EPSILON
219        MAX_FLUX
220        MIN_FLUX
221        NB_BOOT_LOOPS
222        NB_DATA_BOOT
223        NB_LAMBDA_MAX
224        NB_OB_MAX
225        OBS_PATH
226        PLOT_DEV
227        SPIDAST_PATH
228
229 REVISION HISTORY:
230      Written by pcr 2007/08/27
231      last modification by pcr 2010/12/26
232
233----- Documentation for Manip\average_observations.pro -----
234 NAME:
235      AVERAGE_OBSERVATIONS
236
237 AUTHOR:
238      pierre.cruzalebes@oca.eu
239
240 PURPOSE:
241      give observing parameter and baseline files associated to mean data file(s)
242      with multiple observing blocks
243
244 CATEGORY:
245      data manipulation
246
247 INPUTS:
248      needs text input file (in OBS_PATH/INP/ directory) with :
249        - baseline and observing parameter file names (in same row)
250        - number of file(s) to average in each obs block (in same row)
251
252 REQUIREMENTS:
253      data read in input baseline file(s) (in subdirectory of OBS_PATH/)
254      must be in ASCII format and contain (2*NBASE=NTEL*(NTEL-1) columns, one
255      row per data file) :
256        - (START_PBL[m] , START_PBLA[deg]) and (END_PBL[m] , END_PBLA[deg])
257        of the projected baseline(s) associated to each data file
258
259      data read in input observation parameter file(s) (in subdirectory of
260      OBS_PATH/) must be in ASCII format and contain (one row per data file):
261        - (DIT[s] , NDIT), (RA[deg] , DEC[deg]), (START_UTC[h] , END_UTC[h]),
262        (START_FWHM["] , END_FWHM["]), (START_TAU0[s] , END_TAU0[s]), (MJD@0h , 0)
263
264 OUTPUTS:
265      data written in output baseline file(s) (in the same subdirectory
266      of OBS_PATH/) are of same type as input (one row per obs block):
267        - (START_PBL[m] , START_PBLA[deg]) and (END_PBL[m] , END_PBLA[deg])
268        of the projected baseline(s) associated to the output mean data file(s)
269
270      data written in input observation parameter file(s) (in the same subdirectory
271      of OBS_PATH/) are of same type as input (one row per obs block):
272        - (TIT[s] , NDIT=1), (MEAN_RA[deg] , MEAN_DEC[deg]), (MIN_UTC[h] , MAX_UTC[h]),
273        (MIN_FWHM["] , MAX_FWHM["]), (MIN_TAU0[s] , MAX_TAU0[s]), (MJD@0h , 0)
274        associated to the output mean data file(s)
275
276 LOCAL PROCEDURE CALLED:
277       RESET_PLOT
278
279 LOCAL FUNCTION USED:
280        COSD
281        EXTRACT_PROHEADER
282        SIND
283        SYM
284
285 LOCAL SYSTEM VARIABLE USED:
286        NB_OB_MAX
287        NB_PAIR_MAX
288        OBS_PATH
289        PLOT_DEV
290        SPIDAST_PATH
291
292 REVISION HISTORY:
293      Written by pcr 2009/01/25
294      last modification by pcr 2010/12/26
295
296----- Documentation for Manip\concatenate_observations.pro -----
297 NAME:
298      CONCATENATE_OBSERVATIONS
299
300 AUTHOR:
301      pierre.cruzalebes@oca.eu
302
303 PURPOSE:
304      concatenate a set of observing parameter and baseline files of a given
305      target in a single parameter+baseline file
306      split/concatenate obs/base/data file(s) in OB/dir/run/global file(s)
307
308 CATEGORY:
309      data manipulation
310
311 INPUTS:
312      needs text input file (in OBS_PATH/INP/ directory) with :
313        - target name
314       - allocation programme information file
315        - subdir of OBS_PATH for writing results
316
317      then finds the following files associated to target :
318        - baseline file(s)
319        - observing parameter file(s)
320        - spec file(s)
321        - vis file(s)
322        - coh spec file(s)
323        - clos file(s)
324        - bisp file(s)
325        - trip file(s)
326
327 REQUIREMENTS:
328      data read in allocation programme file (in OBS_PATH/ directory) must be in ASCII format
329      and contain 2*nrun+1 rows with :
330      - total number of run(s) allocated for the observing programme and obs run name(s) (same row)
331      then for each run :
332      - nber of allocated night(s) in run and name(s) of obs data directory(ies) (1 dir per obs night)
333
334      data read in input baseline file(s) (in subdirectory of OBS_PATH/,
335      .base extension) must be in ASCII format and contain 2*npair=NTEL*(NTEL-1) columns of
336      complex values (one row per obs block) with:
337        - (START_PBL[m] , START_PBLA[deg]) and (END_PBL[m] , END_PBLA[deg])
338        of the projected baseline(s) associated to each OB
339
340      data read in input obs. parameter file(s) (in the same subdir of OBS_PATH/,
341      .obs extension) must be in ASCII format and contain 6 columns of complex values
342      (one row per obs block) with:
343        - (DIT[s] , NDIT), (RA[deg] , DEC[deg]), (START_UTC[h] , END_UTC[h]),
344        (START_FWHM["] , END_FWHM["]), (START_TAU0[s] , END_TAU0[s]), (MJD@0h , 0)
345
346      data read in input spectrum file(s) (in subdir of OBS_PATH/ containing
347      input data, .spec extension) must be in ASCII format and contain (1 row per spectral channel):
348        - wavelength and bandwidth [m], flux and error [W/m^2/mum] for each OB
349
350      data read in input visibility file(s) (in subdir of OBS_PATH/
351      containing input data, .vis extension) must be in ASCII format and contain
352      (1 row per spectral channel, one file per baseline):
353        - wavelength and bandwidth [m], vis. and err. for each OB
354
355      data read in input coherent spectrum file(s) (in subdir of OBS_PATH/
356      containing input data, .coh extension) must be in ASCII format and contain
357      (1 row per spectral channel, one file per baseline):
358        - wavelength and bandwidth [m], coh. flux and err. [W/m^2/mum]
359       for each OB
360
361      data read in input closure phase file(s) (in subdir of OBS_PATH/
362      containing input data, .clos extension) must be in ASCII format and contain
363      (1 row per spectral channel, one file per baseline triplet):
364        - wavelength and bandwidth [m], clos. phase and err. [deg]
365       for each OB
366
367      data read in each input bispectrum file(s) (in subdir of OBS_PATH/
368      containing input data, .bisp extension) must be in ASCII format and contain
369      (1 row per spectral channel, one file per baseline triplet):
370        - wavelength and bandwidth [m], real part of bisp. and err.,
371        imaginary part of bisp. and err. [(W/m^2/mum)^3] for each OB
372
373      data read in each input triple product file(s) (in subdir of OBS_PATH/
374      containing input data, .trip extension) must be in ASCII format and contain
375      (1 row per spectral channel, one file per baseline triplet):
376        - wavelength and bandwidth [m], real part of triple prod. and err.,
377        imaginary part of triple prod. and err. for each OB
378
379 OUTPUTS:
380      data written in output baseline file(s) (in subdirectory of OBS_PATH/,
381      .base extension) are in ASCII format and contain 2*npair=NTEL*(NTEL-1) columns of
382      complex values (one row per obs block) with:
383        - (START_PBL[m] , START_PBLA[deg]) and (END_PBL[m] , END_PBLA[deg])
384        of the projected baseline(s) associated to each OB
385
386      data written in output obs. parameter file(s) (in the same subdir of OBS_PATH/,
387      .obs extension) are in ASCII format and contain 6 columns of complex values
388      (one row per obs block) with:
389        - (DIT[s] , NDIT), (RA[deg] , DEC[deg]), (START_UTC[h] , END_UTC[h]),
390        (START_FWHM["] , END_FWHM["]), (START_TAU0[s] , END_TAU0[s]), (MJD@0h , 0)
391
392      data written in output spectrum file(s) (in subdir of OBS_PATH/ containing
393      input data, .spec extension) are in ASCII format and contain (1 row per spectral channel):
394        - wavelength and bandwidth [m], flux and error [W/m^2/mum] for each OB
395
396      data written in output visibility file(s) (in subdir of OBS_PATH/
397      containing input data, .vis extension) are in ASCII format and contain
398      (1 row per spectral channel, one file per baseline):
399        - wavelength and bandwidth [m], vis. and err. for each OB
400
401      data written in output coherent spectrum file(s) (in subdir of OBS_PATH/
402      containing input data, .coh extension) are in ASCII format and contain
403      (1 row per spectral channel, one file per baseline):
404        - wavelength and bandwidth [m], coh. flux and err. [W/m^2/mum]
405       for each OB
406
407      data written in output closure phase file(s) (in subdir of OBS_PATH/
408      containing input data, .clos extension) are in ASCII format and contain
409      (1 row per spectral channel, one file per baseline triplet):
410        - wavelength and bandwidth [m], clos. phase and err. [deg]
411       for each OB
412
413      data written in each output bispectrum file(s) (in subdir of OBS_PATH/
414      containing input data, .bisp extension) are in ASCII format and contain
415      (1 row per spectral channel, one file per baseline triplet):
416        - wavelength and bandwidth [m], real part of bisp. and err.,
417        imaginary part of bisp. and err. [(W/m^2/mum)^3] for each OB
418
419      data written in each output triple product file(s) (in subdir of OBS_PATH/
420      containing input data, .trip extension) are in ASCII format and contain
421      (1 row per spectral channel, one file per baseline triplet):
422        - wavelength and bandwidth [m], real part of triple prod. and err.,
423        imaginary part of triple prod. and err. for each OB
424
425      data written in concatenated output obs+base file (in the given subdir of OBS_PATH/,
426      .txt extension) are in ASCII format and contain 2*npair+5 columns values
427      (one row per OB) with:
428        - MEAN_DATE_OBS (ISO standard), MEAN_MJD_OBS (in day), MEAN_PBL[RANGE_PBL] (in m)
429       and MEAN_PBLA[RANGE_PBLA] (in deg) of each baseline, MEAN_FWHM[RANGE_FWHM] (in arcsec),
430       MEAN_TAU0[RANGE_TAU0] (in s)
431
432 LOCAL PROCEDURE CALLED:
433       RESET_PLOT
434
435 LOCAL FUNCTION USED:
436       COSD
437       DATE_CONV
438        EXTRACT_PROHEADER
439        SYM
440       SIND
441
442 LOCAL SYSTEM VARIABLE USED:
443        NB_LAMBDA_MAX
444       NB_NIGHT_MAX
445        NB_OB_MAX
446        NB_PAIR_MAX
447        OBS_PATH
448        PLOT_DEV
449        SPIDAST_PATH
450
451 REVISION HISTORY:
452      Written by pcr 2010/05/31
453      last modification by pcr 2011/01/05
454
455----- Documentation for Manip\get_broadband_flux.pro -----
456 NAME:
457      GET_BROADBAND_FLUX
458
459 AUTHOR:
460      pierre.cruzalebes@oca.eu
461
462 PURPOSE:
463      calculate broadband flux from spectrum
464
465 CATEGORY:
466      data manipulation
467
468 INPUTS:
469      needs text input file with:
470        - input spectrum file name
471        - minimum and maximum wavelengths [mum]
472
473 REQUIREMENST:
474      data read in input spectrum file (in OBS_PATH/DATA/ directory)
475      must be in ASCII format and contain (1 row per spectral channel):
476        - wavelength [nm], flux and error [W/m^2/mum]
477
478 OUTPUTS:
479      data written in output broadband flux file (in OBS_PATH/DATA/ directory)
480      are in ASCII format and contain (in same row) :
481        - central wavelength and total bandwidth [mum], mean flux and error
482        in band [W/m^2/mum]
483
484 LOCAL PROCEDURE CALLED:
485        NONE
486
487 LOCAL FUNCTIOD USED:
488        EXTRACT_PROHEADER
489        TRAP
490
491 LOCAL SYSTEM VARIABLE USED:
492        NB_LAMBDA_MAX
493        OBS_PATH
494        SPIDAST_PATH
495
496 REVISION HISTORY:
497      Written by pcr 2009/03/04
498      last modification by pcr
499
500----- Documentation for Manip\get_flux_scale.pro -----
501 NAME:
502      GET_FLUX_SCALE
503
504 AUTHOR:
505      pierre.cruzalebes@oca.eu
506
507 PURPOSE:
508      calculate flux scale factor(s) to apply to input flux file(s)
509      from reference flux in a given band
510
511 CATEGORY:
512      data manipulation
513
514 INPUTS:
515      needs text input file with:
516        - nber of input data file(s)
517        - input data file name(s)
518        - reference flux file
519      AMBER data:
520        - wavelength list name associated to input data file(s)
521
522 REQUIREMENTS:
523      data read in input data file(s) (in OBS_PATH/DATA/ directory)
524      must be in ASCII format and contain (1 row per spectral channel):
525      spec data:
526        - wavelength [nm], flux and error [W/m^2/mum]
527      AMBER data:
528        - weight, vis. and error, flux and error, coh. flux and error
529        [W/m^2/mum]
530
531      data read in reference flux file (in OBS_PATH/DATA/ directory)
532      must be in ASCII format and contain (in this order, 1 spectral band
533      per row) :
534        - central wavelength and spectral bandwidth [mum], mean flux and
535        error in band [W/m^2/mum]
536
537 OUPUTS:
538      data written in output scale file (in OBS_PATH/DATA/ directory)
539      are in ASCII format and contain (1 row per input data file)
540        - flux scale factor
541
542 LOCAL PROCEDURE CALLED:
543        NONE
544
545 LOCAL FUNCTION USED:
546        EXTRACT_PROHEADER
547        TRAP
548
549 LOCAL SYSTEM VARIABLE USED:
550        NB_LAMBDA_MAX
551        OBS_PATH
552        SPIDAST_PATH
553
554 REVISION HISTORY:
555       Written by pcr 2009/02/16
556       last modification by pcr 2009/03/04
557
558----- Documentation for Manip\merge_bands.pro -----
559 NAME:
560      MERGE_BANDS
561
562 AUTHOR:
563      pierre.cruzalebes@oca.eu
564
565 PURPOSE:
566      merge data file(s) obtained in different spectral band(s)
567      and formatting output file(s) for interpretation purpose
568
569 CATEGORY:
570      data manipulation
571
572 INPUTS:
573      needs text input file with:
574        - nber of band(s) to merge and nber of data file(s) per band
575        (in same row)
576        - data file name(s) (input data, 1 row per band)
577        - input wavelength list name(s) associated to data file(s) (in same row)
578        - if nber of bands > 1 : merged wavelength list name (output)
579        - if needed (non-AMBER data): data format ('vis', 'spec' or 'coh')
580
581 REQUIREMENTS:
582      vis data:
583      data read in input vis. file(s) (in subdirectory of OBS_PATH/)
584      must be in ASCII format and contain (1 row per spectral channel) :
585        - visibility (or vis. response) and error
586
587      spec data:
588      data read in input spec. file(s) (in subdirectory of OBS_PATH/)
589      must be in ASCII format and contain (1 row per spectral channel) :
590        - flux (or flux resp.) and error [W/m^2/mum]
591        (or [photoel/(W/m^2/mum)])
592
593      coh. spec data:
594      data read in input coh. spec. file(s) (in subdirectory of OBS_PATH/)
595      must be in ASCII format and contain (1 row per spectral channel) :
596        - coh. flux (or coh. flux resp.) and error
597        [W/m^2/mum] (or [photoel/(W/m^2/mum)])
598
599      AMBER data:
600      data read in input data file(s) (in subdirectory of OBS_PATH/)
601      must be in ASCII format and contain (1 row per spectral channel) :
602        - weight, vis. (or vis. resp.) and error, flux (or flux resp.)
603        and error [W/m^2/mum] (or [photoel/(W/m^2/mum)]), coh. flux (or
604        coh. flux resp.) and error [W/m^2/mum] (or [photoel/(W/m^2/mum)])
605
606      data read in wavelength list(s) (in subdirectory of OBS_PATH/)
607      must be wavelengths and bandwidths [m] in ASCII format (in same order as
608      input data)
609
610 OUTPUTS:
611      vis data:
612      data written in output merged vis. file (in the same subdirectory
613      of OBS_PATH/) are in ASCII format and contain (1 row per spectral
614      channel) :
615        - wavelength and bandwidth [m], vis. (or vis. resp.) and error
616        for each data file
617
618      spec data:
619      data written in output merged spec. file (in the same subdirectory of
620      OBS_PATH/) are in ASCII format and contain (1 row per spectral
621      channel) :
622        - wavelength and bandwidth [m], flux (or flux resp.) and
623        error ([W/m^2/mum] or [photoel] or [photoel/(W/m^2/mum)])
624        for each data file
625
626      coh. spec data:
627      data written in output merged coh. spec. file (in the same subdirectory
628      of OBS_PATH/) are in ASCII format and contain (1 row per spectral
629      channel) :
630        - wavelength and bandwidth [m], coh. flux (or coh. flux resp.)
631        and error [W/m^2/mum] (or [photoel/(W/m^2/mum)]) for each data file
632
633      AMBER data:
634      data written in output merged vis. file (in the same subdir of OBS_PATH/)
635      are in ASCII format and contain (1 row per spectral channel) :
636        - wavelength and bandwidth [m], vis. (or vis. resp.) and error
637        for each data file
638      data written in output merged spec. file (in the same subdir of OBS_PATH/)
639      are in ASCII format and contain (1 row per spectral channel) :
640        - wavelength and bandwidth [m], flux (or flux resp.) and
641        error [W/m^2/mum] (or [photoel/(W/m^2/mum)]) for each data file
642      data written in output merged coh. spec. file (in the same subdirectory
643      of OBS_PATH/) are in ASCII format and contain (1 row per spectral
644      channel) :
645        - wavelength and bandwidth [m], coh. flux (or coh. flux resp.)
646        and error [W/m^2/mum] (or [photoel/(W/m^2/mum)]) for each data file
647
648      data written in wavelength list(s) (in subdirectory of OBS_PATH/)
649      are wavelengths and bandwidths [m] in ASCII format (in same order as
650      output data)
651
652 LOCAL PROCEDURE CALLED:
653        RESET_PLOT
654
655 LOCAL FUNCTION USED:
656        EXTRACT_PROHEADER
657        SYM
658
659 LOCAL SYSTEM VARIABLE USED:
660        MAX_FLUX
661        MIN_FLUX
662        OBS_PATH
663        NB_LAMBDA_MAX
664        PLOT_DEV
665        SPIDAST_PATH
666
667 REVISION HISTORY:
668      Written by pcr 2007/10/07
669      last modification by pcr 2010/12/26
670
671----- Documentation for Manip\merge_bisp_bands.pro -----
672 NAME:
673      MERGE_BISP_BANDS
674
675 AUTHOR:
676      pierre.cruzalebes@oca.eu
677
678 PURPOSE:
679      merge data file(s) obtained in different spectral band(s)
680      and formatting output file(s) for fitting purpose
681
682 CATEGORY:
683      data manipulation
684
685 INPUTS:
686      needs text input file with :
687        - nber of band(s) to merge and nber of data file(s) per band
688        (in same row)
689        - data file name(s) (input data, 1 row per band)
690        - input wavelength list name(s) associated to data file(s) (in same row)
691        - if nber of bands > 1 : merged wavelength list name (output)
692        - if needed (default = AMBER format) : data format ('clos' or 'bisp'
693        or 'trip')
694
695 REQUIREMENTS:
696      closure phase data:
697      data read in input data file(s) (in subdirectory of OBS_PATH/)
698      must be in ASCII format and contain (1 row per spectral channel) :
699        - closure phase and err. [deg]
700
701      bispectrum data:
702      data read in input data file(s) (in subdirectory of OBS_PATH/)
703      must be in ASCII format and contain (1 row per spectral channel) :
704        - wavelength [nm], weight, real part of bispectrum and error,
705        imaginary part of bispectrum and error [(W/m^2/mum)^3] or
706        [photoel^3] or [photoel^3/(W/m^2/mum)^3])
707
708      triple product data:
709      data read in input data file(s) (in subdirectory of OBS_PATH/)
710      must be in ASCII format and contain (1 row per spectral channel) :
711        - wavelength [nm], weight, real part of triple product and error,
712        imaginary part of triple product and error
713
714      AMBER data (default):
715      data read in input data file(s) (in subdirectory of OBS_PATH/)
716      must be in ASCII format and contain (1 row per spectral channel) :
717        - wavelength [nm], weight, real part of bispectrum and error,
718        imaginary part of bispectrum and error [(W/m^2/mum)^3] or
719        [photoel^3] or [photoel^3/(W/m^2/mum)^3]), real part of triple product and error,
720        imaginary part of triple product and error
721
722      data read in wavelength list(s) (in subdirectory of OBS_PATH/)
723      must be wavelengths and bandwidths [m] in ASCII format (in same order as
724      input data)
725
726 OUTPUTS:
727      closure phase data:
728      data written in output merged closure phase file (in the same
729      subdirectory of OBS_PATH/) are in ASCII format and contain (1 row per
730      spectral channel) :
731        - wavelength and bandwidth [m], closure phase and err. [deg]
732        for each data file
733
734      bispectrum data:
735      data written in output merged closure phase file (in the same
736      subdirectory of OBS_PATH/) are in ASCII format and contain (1 row per
737      spectral channel) :
738        - wavelength and bandwidth [m], closure phase and err. [deg]
739        for each data file
740      data written in output merged bispectrum file (in subdirectory of
741      OBS_PATH/) are in ASCII format and contain (1 row per spectral
742      channel) :
743        - wavelength and bandwidth [m], real part of bispectrum and error,
744        imaginary part of bispectrum and error ([(W/m^2/mum)^3] or
745        [photoel^3] or [photoel^3/(W/m^2/mum)^3]) for each data file
746
747      triple product data:
748      data written in output merged closure phase file (in the same
749      subdirectory of OBS_PATH/) are in ASCII format and contain (1 row per
750      spectral channel) :
751        - wavelength and bandwidth [m], closure phase and err. [deg]
752        for each data file
753      data written in output merged triple product file (in subdirectory of
754      OBS_PATH/) are in ASCII format and contain (1 row per spectral
755      channel) :
756        - wavelength and bandwidth [m], real part of triple product and error,
757        imaginary part of triple product and error for each data file
758
759      AMBER data (default):
760      data written in output merged closure phase file (in the same
761      subdirectory of OBS_PATH/) are in ASCII format and contain (1 row per
762      spectral channel) :
763        - wavelength and bandwidth [m], closure phase and err. [deg]
764        for each data file
765      data written in output merged bispectrum file (in subdirectory of
766      OBS_PATH/) are in ASCII format and contain (1 row per spectral
767      channel) :
768        - wavelength and bandwidth [m], real part of bispectrum and error,
769        imaginary part of bispectrum and error ([(W/m^2/mum)^3] or
770        [photoel^3] or [photoel^3/(W/m^2/mum)^3]) for each data file
771      data written in output merged triple product file (in subdirectory of
772      OBS_PATH/) are in ASCII format and contain (1 row per spectral
773      channel) :
774        - wavelength and bandwidth [m], real part of triple product and error,
775        imaginary part of triple product and error for each data file
776
777      data written in wavelength list(s) (in subdirectory of OBS_PATH/)
778      are wavelengths and bandwidths [m] in ASCII format (in same order as
779      output data)
780
781 LOCAL PROCEDURE CALLED:
782        RESET_PLOT
783
784 LOCAL FUNCTION USED:
785        COSD
786        EXTRACT_PROHEADER
787        SIND
788        SYM
789       TRI_STDEV
790
791 LOCAL SYSTEM VARIABLE USED:
792        EPSILON
793       MAX_REL_ERR
794        NB_LAMBDA_MAX
795        OBS_PATH
796        PLOT_DEV
797        SPIDAST_PATH
798
799 REVISION HISTORY:
800       Written by pcr 2008/05/20
801       last modification by pcr 2011/01/09
802
803----- Documentation for Manip\replace_bisp_mod.pro -----
804 NAME:
805      REPLACE_BISP_MOD
806
807 AUTHOR:
808      pierre.cruzalebes@oca.eu
809
810 PURPOSE:
811      replace modulus of complex bispectrum or triple product
812      with triple product of coherent fluxes or visibilities
813
814 CATEGORY:
815      data manipulation
816
817 INPUTS:
818      needs text input file with:
819        - data format ('bisp' or 'trip')
820        - input bispectrum or triple product file name
821        - triplet of coherent flux or visibilities file names (in same row)
822
823 REQUIREMENTS:
824      data read in input complex bispectrum file (in subdirectory of OBS_PATH/)
825      must be (in this order, one raw per spectral channel) :
826        - wavelength and bandwidth [m], real part of bispectrum and error,
827        imaginary part of bispectrum and error [(W/m^2/mu)^3] for each observing block
828
829      data read in input complex triple product file (in subdirectory of OBS_PATH/)
830      must be (in this order, one raw per spectral channel) :
831        - wavelength and bandwidth [m], real part of triple product and error,
832        imaginary part of triple product and error for each observing block
833
834      data read in input coherent flux files (in same subdirectory of OBS_PATH/)
835      must be in ASCII format and contain (1 row per spectral channel):
836        - wavelength and bandwidth [m], coh. flux and error [W/m^2/mum] for each data file
837
838      data read in input visibility files (in same subdirectory of OBS_PATH/)
839      must be in ASCII format and contain (1 row per spectral channel):
840        - wavelength and bandwidth [m], visibility and error for each observing block
841
842 OUTPUTS:
843       data written in output complex bispectrum file(s)
844      (in same subdirectory of OBS_PATH/) are (in this order, one row per wavelength) :
845        - wavelength and bandwidth [m], real part of modulus-replaced bispectrum
846        and error, imaginary part of modulus-replaced bispectrum and error
847        [(W/m^2/mu)^3] for each observing block
848
849       data written in output complex triple product file(s)
850      (in same subdirectory of OBS_PATH/) are (in this order, one row per wavelength) :
851        - wavelength and bandwidth [m], real part of modulus-replaced triple product
852        and error, imaginary part of modulus-replaced triple product and error
853        for each observing block
854
855 LOCAL PROCEDURE CALLED:
856        RESET_PLOT
857
858 LOCAL FUNCTION USED:
859        EXTRACT_PROHEADER
860       GET_OUTLIER_FENCES
861
862 LOCAL SYSTEM VARIABLE USED:
863       MAX_REL_ERR
864       NB_OB_MAX
865        OBS_PATH
866        PLOT_DEV
867        SPIDAST_PATH
868
869 REVISION HISTORY:
870      Written by pcr 2009/02/19
871      last modification by pcr 2011/01/15
872
873----- Documentation for Manip\scale_flux.pro -----
874 NAME:
875      SCALE_FLUX
876
877 AUTHOR:
878      pierre.cruzalebes@oca.eu
879
880 PURPOSE:
881      correct flux and/or coherent flux with flux scale factor(s)
882
883 INPUTS:
884      needs text input file with:
885        - flux scale factor file
886        - input data file name(s)
887
888 REQUIREMENTS:
889      data read in input scale file (in OBS_PATH/DATA/ directory)
890      must be in ASCII format and contain (1 row per input data file)
891        - flux scale factor and error
892
893      flux or coh. flux data:
894      data read in input data file(s) (in OBS_PATH/DATA/ directory)
895      must be in ASCII format and contain (1 row per spectral channel):
896        - wavelength, flux or coh. flux and error [W/m^2/mum]
897
898      AMBER data:
899      data read in input data file(s) (in OBS_PATH/DATA/ directory)
900      must be (in this order, one raw per spectral channel) :
901        - weight, vis. and error, flux and error, coh. flux and error
902        [W/m^2/mum]
903
904 OUTPUTS:
905      flux or coh. flux data:
906      data written in input data file(s) (in OBS_PATH/DATA/ directory)
907      are in ASCII format and contain (1 row per spectral channel):
908        - wavelength, corr. flux or corr. coh. flux and error [W/m^2/mum]
909
910      AMBER data:
911      data written in output scaled data file(s) (in OBS_PATH/DATA/ directory)
912      are (in this order, one row per wavelength) :
913        - weight, vis. and error, scaled flux and error, scaled coh. flux
914        and error [W/m^2/mum]
915
916 LOCAL PROCEDURE CALLED:
917        RESET_PLOT
918
919 LOCAL FUNCTION USED:
920        EXTRACT_PROHEADER
921
922 LOCAL SYSTEM VARIABLE USED:
923        OBS_PATH
924        PLOT_DEV
925        SPIDAST_PATH
926
927 REVISION HISTORY:
928       Written by pcr 2009/02/18
929       last modification by pcr
930
931----- Documentation for Manip\select_bisp.pro -----
932 NAME:
933      SELECT_BISP
934
935 AUTHOR:
936      pierre.cruzalebes@oca.eu
937
938 PURPOSE:
939      select input bispectral data
940      based on measurements and errors
941
942 CATEGORY:
943      data manipulation
944
945 INPUTS:
946      needs a text input file (in OBS_PATH/INP/ directory) with :
947        - data file number
948        - input data file name(s)
949        - min/max thresholds for Re(bisp)+error, Im(bisp)+error (in same row)
950
951 REQUIREMENTS:
952      data read in input bisp data file(s) (in OBS_PATH/DATA/ directory)
953      must be in ASCII format and contain :
954        - lambda (in nm), number of sel. frames, Re(bisp) and error,
955        Im(bisp) and error (in photoelectrons^3)
956
957 OUTPUTS:
958      data written in output file(s) (in OBS_PATH/DATA/ directory)
959      are (in this order, one row per spectral channel) :
960        - lambda (in nm), nber of sel. fr. (null if data not selected),
961        Re(bisp) and error, Im(bisp) and err. (in photoelectrons^3)
962
963 LOCAL PROCEDURE CALLED:
964        RESET_PLOT
965
966 LOCAL FUNCTION USED:
967        EXTRACT_PROHEADER
968
969 LOCAL SYSTEM VARIABLE USED:
970        OBS_PATH
971        SPIDAST_PATH
972
973 REVISION HISTORY:
974       Written by pcr 2008/05/05
975       last modification by pcr 2008/05/14
976
977----- Documentation for Manip\select_data.pro -----
978 NAME:
979      SELECT_DATA
980
981 AUTHOR:
982      pierre.cruzalebes@oca.eu
983
984 PURPOSE:
985      select input data
986      based on measurements and errors
987
988 CATEGORY:
989      data manipulation
990
991 INPUTS:
992      needs a text input file (in OBS_PATH/INP/ directory) with :
993        - data file number
994        - input data file name(s)
995        - min/max thresholds for visibility/error, flux/error and coherent
996        flux/error (in same row)
997
998 REQUIREMENTS:
999      data read in input data file(s) (in OBS_PATH/DATA/ directory)
1000      must be in ASCII format and contain :
1001        - weight, visibility and error, flux and error, coherent flux and
1002        error
1003
1004 OUTPUTS:
1005      data written in output file(s) (in OBS_PATH/DATA/ directory)
1006      are (in this order, one row per spectral channel) :
1007        - weight (null if data not selected), vis. and error, flux and err.,
1008        coh. flux and err.
1009
1010 LOCAL PROCEDURE CALLED:
1011        RESET_PLOT
1012
1013 LOCAL FUNCTION USED:
1014        EXTRACT_PROHEADER
1015
1016 LOCAL SYSTEM VARIABLE USED:
1017        OBS_PATH
1018        SPIDAST_PATH
1019
1020 REVISION HISTORY:
1021       Written by pcr 2007/04/25
1022       last modification by pcr 2008/05/19
1023
1024----- Documentation for Manip\shift_vis.pro -----
1025 NAME:
1026      SHIFT_VIS
1027
1028 AUTHOR:
1029      pierre.cruzalebes@oca.eu
1030
1031 PURPOSE:
1032      shift visibilities of second data file up or down towards visibility
1033      of first file used as reference by polynomial fit continuity
1034
1035 CATEGORY:
1036      data manipulation
1037
1038 INPUTS:
1039      needs text input file (in OBS_PATH/INP/ directory) with :
1040        - name of first data file used as visibility reference (input data)
1041        - name of second data file to be corrected (input data)
1042        - name of wavelength list associated to first data file (input data)
1043        - name of wavelength list associated to second data file (input data)
1044        - polynomial degree of first data file, degree of second data file
1045        (if one null : no shift), number of bad data at band boundary for
1046        first file, number of bad data for second, wavelength used for
1047        continuity (if null uses mean wavelength between bands)
1048
1049 REQUIREMENTS:
1050      data read in input data files (in OBS_PATH/DATA/ directory)
1051      must be in ASCII format and contain (1 row per spectrum channel) :
1052      visibility and error, flux and error (in W.m^-2.mu^-1), coherent flux
1053      and error (in W.m^-2.mu^-1)
1054
1055      data read in wavelength lists (in OBS_PATH/DATA/ directory)
1056      must be wavelengths (in mu) in ASCII format (in same order than input data)
1057
1058 OUTPUTS:
1059      data written in output visibility-shifted data file (in OBS_PATH/DATA/
1060      directory) are in ASCII format and contain (1 row per spectrum
1061      channel) :
1062        - visibility and error, flux and error (in W.m^-2.mu^-1), coherent
1063        flux and error (in W.m^-2.mu^-1)
1064
1065 LOCAL PROCEDURE CALLED:
1066        RESET_PLOT
1067
1068 LOCAL FUNCTION USED:
1069        EXTRACT_PROHEADER
1070
1071 LOCAL SYSTEM VARIABLE USED:
1072        OBS_PATH
1073        SPIDAST_PATH
1074
1075 REVISION HISTORY:
1076       Written by pcr 2007/10/07
1077       last modification by pcr 2008/02/13
1078