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

« back to all changes in this revision

Viewing changes to gui/XFilter/src/do_trans.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
/*===========================================================================
 
2
  Copyright (C) 1995-2009 European Southern Observatory (ESO)
 
3
 
 
4
  This program is free software; you can redistribute it and/or 
 
5
  modify it under the terms of the GNU General Public License as 
 
6
  published by the Free Software Foundation; either version 2 of 
 
7
  the License, or (at your option) any later version.
 
8
 
 
9
  This program is distributed in the hope that it will be useful,
 
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
  GNU General Public License for more details.
 
13
 
 
14
  You should have received a copy of the GNU General Public 
 
15
  License along with this program; if not, write to the Free 
 
16
  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, 
 
17
  MA 02139, USA.
 
18
 
 
19
  Correspondence concerning ESO-MIDAS should be addressed as follows:
 
20
        Internet e-mail: midas@eso.org
 
21
        Postal address: European Southern Observatory
 
22
                        Data Management Division 
 
23
                        Karl-Schwarzschild-Strasse 2
 
24
                        D 85748 Garching bei Muenchen 
 
25
                        GERMANY
 
26
 
 
27
.VERSION
 
28
 090826         last modif
 
29
 
 
30
===========================================================================*/
 
31
 
 
32
 
 
33
#include <math.h>
 
34
#include <stdio.h>
 
35
#include <globaldef.h>
 
36
#include <model.h>
 
37
 
 
38
 
 
39
extern void c_minmax(), plot_xy(), end_graphic1();
 
40
extern void set_range();
 
41
 
 
42
 
 
43
 
 
44
void    do_trans()
 
45
{
 
46
extern  struct s_trans  T;
 
47
extern  struct s_mod    M;
 
48
extern  float   XWmin,XWmax;
 
49
extern  int     Natmos;
 
50
extern  float   Xatmos[],Yatmos[];
 
51
extern  int     Ngrism;
 
52
extern  float   Xgrism[],Ygrism[];
 
53
extern  int     Nmir;
 
54
extern  float   Xmir[],Ymir[];
 
55
extern  int     Noptics;
 
56
extern  float   Xoptics[],Yoptics[];
 
57
extern  int     Nfilter;
 
58
extern  float   Xfilt[],Yfilt[];
 
59
extern  int     Nccd;
 
60
extern  float   Xccd[],Yccd[];
 
61
extern  float   Oxmi,Oxma,Oymi,Oyma;
 
62
 
 
63
register int    i;
 
64
float   xr[6000],yr[6000];
 
65
char    str[150], str1[40];
 
66
float   interpol(),poisson();
 
67
float   xmi,xma,ymi,yma;
 
68
 
 
69
 
 
70
 
 
71
set_range();
 
72
 
 
73
if (T.resolution!=0.)
 
74
        M.nmax=(int)((XWmax-XWmin)/T.resolution);
 
75
else
 
76
        M.nmax=200.;
 
77
 
 
78
if (M.nmax>4000)
 
79
        {
 
80
        M.nmax=4000;
 
81
        fprintf(stderr,"WARNING: array too small, resolution reduced\r\n");
 
82
        };
 
83
for(i=0;i<M.nmax;i++)
 
84
        {
 
85
        xr[i]=XWmin+((float)i)/((float) (M.nmax-1))*(XWmax-XWmin);
 
86
        yr[i]=1.;
 
87
        };
 
88
 
 
89
if (T.iatmos !=0)
 
90
        {
 
91
        for(i=0;i<M.nmax;i++)
 
92
              yr[i]*=interpol(xr[i],Xatmos,Yatmos,Natmos);
 
93
        };
 
94
 
 
95
if (T.imirror !=0)
 
96
    {
 
97
    for(i=0;i<M.nmax;i++)
 
98
        yr[i]*=yr[i]*=interpol(xr[i],Xmir,Ymir,Nmir);
 
99
    };
 
100
 
 
101
if (T.igrism !=0)
 
102
        {
 
103
        for(i=0;i<M.nmax;i++)
 
104
              yr[i]*=interpol(xr[i],Xgrism,Ygrism,Ngrism);
 
105
        };
 
106
 
 
107
if (T.ifilter !=0)
 
108
        {
 
109
        for(i=0;i<M.nmax;i++)
 
110
              yr[i]*=interpol(xr[i],Xfilt,Yfilt,Nfilter);
 
111
        };
 
112
 
 
113
if (T.ioptics !=0)
 
114
        {
 
115
        for(i=0;i<M.nmax;i++)
 
116
              yr[i]*=interpol(xr[i],Xoptics,Yoptics,Noptics);
 
117
        };
 
118
 
 
119
if (T.iccd !=0)
 
120
        {
 
121
        for(i=0;i<M.nmax;i++)
 
122
              yr[i]*=interpol(xr[i],Xccd,Yccd,Nccd);
 
123
        };
 
124
 
 
125
c_minmax(xr,yr,M.nmax,&xmi,&xma,&ymi,&yma);
 
126
 
 
127
sprintf(str1,"\1 Total Transmission");
 
128
sprintf(str,
 
129
  "TITLE=%20s;DTITL=%4.1f;LABX=%12s;LABY=%12s;DLABL=%4.1f;NGEOM;USER;BOLD;GRID;TIME;XSPACE=%1d;",
 
130
     str1, 2.0, "\1Wave [nm]", "\1 Transmission",1.0,0);
 
131
 
 
132
yma=Min(1.,yma+.1);
 
133
ymi=0.;
 
134
 
 
135
plot_xy(str,0,xr,yr,M.nmax,XWmin,XWmax,0.,yma);
 
136
end_graphic1();
 
137
Oxmi=xmi;
 
138
Oxma=xma;
 
139
Oymi=ymi;
 
140
Oyma=yma;
 
141
 
 
142
}