~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to stdred/feros/libsrc/extract_cuts.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)extract_cuts.c   19.1 (ESO-IPG) 02/25/03 14:21:23 */
 
2
/*
 
3
 
 
4
  Otmar Stahl
 
5
 
 
6
  extract_cuts.c
 
7
 
 
8
  extract lines from echelle spectrum
 
9
  
 
10
  IN:    
 
11
  imno:            input frame
 
12
  first_cut:       first cut in y
 
13
  cut_step :       step in y
 
14
  cut_nr:          number of cuts
 
15
  npix:            size of input frame
 
16
  
 
17
  OUT:
 
18
  imageo:          array holding output, space must be reserved
 
19
 
 
20
*/
 
21
 
 
22
/* general Midas includes */
 
23
 
 
24
#include <midas_def.h>
 
25
 
 
26
int extract_cuts 
 
27
#ifdef __STDC__
 
28
(
 
29
 int imno, int first_cut, int cut_step, int cut_nr, 
 
30
 float imageo[], int npix[]
 
31
 )
 
32
#else
 
33
     (
 
34
      imno, first_cut, cut_step, cut_nr, imageo, npix
 
35
      )
 
36
     int  imno, first_cut, cut_step, cut_nr, npix[];
 
37
     float imageo[];
 
38
#endif
 
39
 
 
40
 
 
41
{
 
42
  float *buffer;
 
43
  int i, j, jj, actvals, pix_step, k, kk, l;
 
44
  
 
45
  buffer =  (float *)osmmget(npix[0] * sizeof(float));
 
46
  
 
47
  pix_step = cut_step * npix[0];
 
48
  j = -npix[0];
 
49
 
 
50
  jj = (first_cut + 1)* npix[0] + 1; 
 
51
 
 
52
  for(i = 0; i < cut_nr; i++)
 
53
    {
 
54
 
 
55
      /* -1 0 + 1 */
 
56
 
 
57
      /*      kk = jj - npix[0];   */
 
58
 
 
59
      kk = jj;  
 
60
 
 
61
      j = j + npix[0];
 
62
 
 
63
      /*  average three lines */
 
64
      
 
65
      for(k = 0; k<npix[0]; k++)
 
66
        {
 
67
          imageo[j+k] = 0.0;
 
68
        }
 
69
      for(k = 0 ; k<1; k++)
 
70
        {
 
71
          SCFGET(imno, kk, npix[0], &actvals, (char *)buffer);
 
72
          for(l = 0; l<npix[0]; l++)
 
73
            {
 
74
              imageo[j+l] = imageo[j+l]+buffer[l];
 
75
            }
 
76
          kk = kk + npix[0];
 
77
        }
 
78
 
 
79
      /*      SCFGET(imno, jj, npix[0], &actvals, (char *) &imageo[j]); */
 
80
 
 
81
      jj = jj + pix_step;
 
82
    }
 
83
  return 0;
 
84
}
 
85