-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRTMLDetector.java
More file actions
251 lines (231 loc) · 5.85 KB
/
RTMLDetector.java
File metadata and controls
251 lines (231 loc) · 5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/*
Copyright 2006, Astrophysics Research Institute, Liverpool John Moores University.
This file is part of org.estar.rtml.
org.estar.rtml is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
org.estar.rtml is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with org.estar.rtml; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// RTMLDetector.java
// $Header: /space/home/eng/cjm/cvs/org_estar_rtml/RTMLDetector.java,v 1.6 2013-01-14 11:04:42 cjm Exp $
package org.estar.rtml;
import java.io.*;
/**
* This class is a data container for information contained in the Detector nodes/tags of an RTML document.
* @author Chris Mottram
* @version $Revision$
* @see org.estar.rtml.RTMLAttributes
*/
public class RTMLDetector extends RTMLAttributes implements Serializable
{
/**
* Revision control system version id.
*/
public final static String RCSID = "$Id$";
/**
* Serial version ID. Fixed as these documents can be used as parameters in RMI calls across JVMs.
*/
static final long serialVersionUID = -4089518386587922272L;
/**
* The Detector Binning row number.
*/
private int rowBinning = 2;
/**
* The Detector Binning column number.
*/
private int columnBinning = 2;
/**
* The gain to be used by the detector. Only really used for EMCCDs, where we take it to mean
* EMGain, which is not quite the same thing, but close enough.
*/
private double gain = 1.0;
/**
* This boolean is used to indicate the gain value has been set.
*/
private boolean useGain = false;
/**
* Default constructor.
* @see #useGain
*/
public RTMLDetector()
{
super();
useGain = false;
}
/**
* Method to set the row binning.
* @param i The row binning.
* @see #rowBinning
*/
public void setRowBinning(int i)
{
rowBinning = i;
}
/**
* Method to set the row binning.
* @param s The row binning as a string.
* @exception RTMLException Thrown if the string is not a valid integer.
* @see #rowBinning
*/
public void setRowBinning(String s) throws RTMLException
{
try
{
rowBinning = Integer.parseInt(s);
}
catch(NumberFormatException e)
{
throw new RTMLException(this.getClass().getName()+":setRowBinning:Number Format Exception:"+
s+":",e);
}
}
/**
* Method to get the row binning.
* @return The row binning.
* @see #rowBinning
*/
public int getRowBinning()
{
return rowBinning;
}
/**
* Method to set the column binning.
* @param i The column binning.
*/
public void setColumnBinning(int i)
{
columnBinning = i;
}
/**
* Method to set the column binning.
* @param s The column binning as a string.
* @exception RTMLException Thrown if the string is not a valid integer.
* @see #columnBinning
*/
public void setColumnBinning(String s) throws RTMLException
{
try
{
columnBinning = Integer.parseInt(s);
}
catch(NumberFormatException e)
{
throw new RTMLException(this.getClass().getName()+":setColumnBinning:Number Format Exception:"+
s+":",e);
}
}
/**
* Method to get the column binning.
* @return The column binning.
* @see #columnBinning
*/
public int getColumnBinning()
{
return columnBinning;
}
/**
* Method to set the gain.
* @param d The gain.
* @see #gain
* @see #useGain
*/
public void setGain(double d)
{
gain = d;
useGain = true;
}
/**
* Method to set the gain.
* @param s The gain as a double string.
* @exception RTMLException Thrown if the string is not a valid double.
* @see #gain
* @see #useGain
*/
public void setGain(String s) throws RTMLException
{
try
{
gain = Double.parseDouble(s);
useGain = true;
}
catch(NumberFormatException e)
{
throw new RTMLException(this.getClass().getName()+":setGain:Number Format Exception:"+
s+":",e);
}
}
/**
* Method to get the gain.
* @return The gain. This is normally only used for EMCCD, where it represents the
* multiplying factor.
* @see #gain
*/
public double getGain()
{
return gain;
}
/**
* Get whether the gain value has been set.
* @return A boolean, true if the gain value has been set.
* @see #useGain
*/
public boolean getUseGain()
{
return useGain;
}
/**
* String representation of this Detector.
* @see #toString(java.lang.String)
*/
public String toString()
{
return(toString(""));
}
/**
* String representation of this Detector, with specified prefix.
* @param prefix A string to prefix to each line of data we print out.
* @see #rowBinning
* @see #columnBinning
* @see org.estar.rtml.RTMLAttributes#toString(java.lang.String)
*/
public String toString(String prefix)
{
StringBuffer sb = new StringBuffer();
sb.append(prefix+"Detector :\n");
sb.append(super.toString(prefix+"\t"));
sb.append(prefix+"\tRow Binning : "+rowBinning+"\n");
sb.append(prefix+"\tColumn Binning : "+columnBinning+"\n");
if(useGain)
sb.append(prefix+"\tGain : "+gain+"\n");
return(sb.toString());
}
}
//
// $Log: not supported by cvs2svn $
// Revision 1.5 2008/05/27 14:07:55 cjm
// Added serialVersionUID.
//
// Revision 1.4 2008/05/23 14:15:24 cjm
// Now extends RTMLAttributes.
//
// Revision 1.3 2007/01/30 18:31:11 cjm
// gnuify: Added GNU General Public License.
//
// Revision 1.2 2005/06/08 11:38:29 cjm
// Fixed comments.
// Reformatted.
//
// Revision 1.1 2005/01/19 11:53:42 cjm
// Initial revision
//
// Revision 1.1 2005/01/18 15:08:28 cjm
// Initial revision
//
//