Skip to content

Commit 4a5b531

Browse files
add mock loc2glob
1 parent 7f27bcd commit 4a5b531

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

mccd/mccd_utils.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,104 @@ def shift_coord(self, ccd_n):
205205
return x_shift, y_shift
206206

207207

208+
class Loc2Glob_mock(object):
209+
r"""Change from local to global coordinates.
210+
211+
Class to pass from local coordinates to global coordinates under
212+
for a mock instrument.
213+
214+
Note: This class is useful if only one CCD is used and we want to mock the instrument,
215+
but set the correct `x` and `y` coordinate limits.
216+
217+
Parameters
218+
----------
219+
x_gap: int
220+
Gap between the CCDs on the horizontal direction.
221+
Default to ``70`` (CFIS value).
222+
y_gap: int
223+
Gap between the CCDs on the vertical direction.
224+
Default to ``425`` (CFIS value).
225+
x_npix: int
226+
Number of pixels on one CCD on the horizontal direction.
227+
Default to ``2048`` (CFIS value).
228+
y_npix: int
229+
Number of pixels on one CCD on the vertical direction.
230+
Default to ``4612`` (CFIS value).
231+
ccd_tot: int
232+
Total number of CCDs.
233+
Default to ``40`` (CFIS value).
234+
235+
"""
236+
237+
def __init__(
238+
self,
239+
x_lim=[0, 1e3],
240+
y_lim=[0, 1e3],
241+
x_gap=0,
242+
y_gap=0,
243+
x_npix=0,
244+
y_npix=0,
245+
ccd_tot=1,
246+
):
247+
r"""Initialize with instrument geometry."""
248+
self.x_lim = x_lim
249+
self.y_lim = y_lim
250+
self.x_gap = x_gap
251+
self.y_gap = y_gap
252+
self.x_npix = x_npix
253+
self.y_npix = y_npix
254+
self.ccd_tot = ccd_tot
255+
256+
def loc2glob_img_coord(self, ccd_n, x_coor, y_coor):
257+
r"""Go from the local to the global img (pixel) coordinate system.
258+
259+
Global system with (0,0) in the intersection of ccds [12,13,21,22].
260+
261+
Parameters
262+
----------
263+
ccd_n: int
264+
CCD number of the considered positions.
265+
x_coor: float
266+
Local coordinate system hotizontal value.
267+
y_coor: float
268+
Local coordinate system vertical value.
269+
270+
Returns
271+
-------
272+
glob_x_coor: float
273+
Horizontal position in global coordinate system.
274+
glob_y_coor: float
275+
Vertical position in global coordinate system.
276+
277+
"""
278+
raise NotImplementedError
279+
280+
def flip_coord(self, ccd_n, x_coor, y_coor):
281+
r"""Change of coordinate convention.
282+
283+
So that all of them are coherent on the global coordinate system.
284+
So that the origin is on the south-west corner.
285+
Positive: South to North ; West to East.
286+
"""
287+
raise NotImplementedError
288+
289+
def x_coord_range(self):
290+
r"""Return range of the x coordinate."""
291+
return self.x_lim[0], self.x_lim[1]
292+
293+
def y_coord_range(self):
294+
r"""Return range of the y coordinate."""
295+
return self.y_lim[0], self.y_lim[1]
296+
297+
def shift_coord(self, ccd_n):
298+
r"""Provide the shifting.
299+
300+
It is needed to go from the local coordinate
301+
system origin to the global coordinate system origin.
302+
"""
303+
raise NotImplementedError
304+
305+
208306
class Loc2Glob_EUCLID_sim(object):
209307
r"""Change from local to global coordinates.
210308

0 commit comments

Comments
 (0)