wcs 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module Wcs
2
+ VERSION="0.1.0"
3
+ end
@@ -0,0 +1,484 @@
1
+ module Wcs
2
+ class WorldCoor
3
+
4
+ # set up a WCS structure from arguments
5
+ #
6
+ # @overload initiallize(cra,cdec,secpix,xrpix,yrpix,nxpix,nypix,rotate,equinox,proj)
7
+ # @param [Float] cra Center right ascension in degrees
8
+ # @param [Float] cdec Center declination in degrees
9
+ # @param [Float] secpix Number of arcseconds per pixel
10
+ # @param [Float] xrpix Reference pixel X coordinate
11
+ # @param [Float] yrpix Reference pixel X coordinate
12
+ # @param [Integer] nxpix Number of pixels along x-axis
13
+ # @param [Integer] nypix Number of pixels along y-axis
14
+ # @param [Float] rotate Rotation angle (clockwise positive) in degrees
15
+ # @param [Integer] equinox Equinox of coordinates, 1950 and 2000 supported
16
+ # @param [Float] epoch Epoch of coordinates, for FK4/FK5 conversion, no effect if 0
17
+ # @param [String] proj Projection
18
+ # @overload initialize(naxis1,naxis2,ctype1,ctype2,crpix1,crpix2,crval1,crval2,cd,cdelt1,cdelt2,crota,equinox,epoch)
19
+ # @param [Integer] naxis1 Number of pixels along x-axis
20
+ # @param [Integer] naxis2 Number of pixels along y-axis
21
+ # @param [String] ctype1 FITS WCS projection for axis 1
22
+ # @param [String] ctype2 FITS WCS projection for axis 2
23
+ # @param [Float] crpix1 Reference pixel coordinates
24
+ # @param [Float] crpix2 Reference pixel coordinates
25
+ # @param [Float] crval1 Coordinate at reference pixel in degrees
26
+ # @param [Float] crval2 Coordinate at reference pixel in degrees
27
+ # @param [Float] cd Rotation matrix, used if not NULL
28
+ # @param [Float] cdelt1 scale in degrees/pixel, if cd is NULL
29
+ # @param [Float] cdelt2 scale in degrees/pixel, if cd is NULL
30
+ # @param [Float] crota Rotation angle in degrees, if cd is NULL
31
+ # @param [Integer] equinox Equinox of coordinates, 1950 and 2000 supported
32
+ # @param [Float] epoch Epoch of coordinates, for FK4/FK5 conversion
33
+ # @overload initialize(hstring,wcsname)
34
+ # @param [String] hstring FITS header
35
+ # @param [String] wcsname WCS name
36
+ def initialize(*args)
37
+ end
38
+
39
+ # Set projection type from header CTYPEs
40
+ #
41
+ # @param [String] ctype1 FITS WCS projection for axis 1
42
+ # @param [String] ctype2 FITS WCS projection for axis 2
43
+ # @return [Integer]
44
+ def wcstype(ctype1,ctype2)
45
+ # This function is defined in C
46
+ end
47
+
48
+ # @return [Boolean] Returns 1 if wcs structure set, else 0
49
+ def iswcs
50
+ end
51
+
52
+ # @return [Boolean] Returns 0 if wcs structure set, else 1
53
+ def nowcs
54
+ end
55
+
56
+ # Convert pixel coordinates to World Coordinate string
57
+ #
58
+ # @param [Float] xpix Image horizontal coordinate in pixels
59
+ # @param [Float] ypix Image vertical coordinate in pixels
60
+ # @return [String] World coordinate string
61
+ def pix2wcst(xpix,ypix)
62
+ # This function is defined in C
63
+ end
64
+
65
+ # Convert pixel coordinates to World Coordinates
66
+ #
67
+ # @param [Float] xpix Image horizontal coordinate in pixels
68
+ # @param [Float] ypix Image vertical coordinate in pixels
69
+ # @return [[xpos,ypos]] RA and Dec in degrees
70
+ def pix2wcs(xpix,ypix)
71
+ # This function is defined in C
72
+ end
73
+
74
+ # Convert World Coordinates to pixel coordinates
75
+ #
76
+ # @param [Float] xpos Longitude/Right Ascension in degrees
77
+ # @param [Float] ypos Latitude/Declination in degrees
78
+ # @param [String] coorsys Coordinate system (FK4, FK5, B1950, J2000, GALACTIC, ECLIPTIC)
79
+ # @return [[xpix,ypix,offscl]]
80
+ # * xpix: Image horizontal coordinate in pixels
81
+ # * ypix: Image vertical coordinate in pixels
82
+ # * offscl: 0 if within bounds, else off scale
83
+ def wcsc2pix(xpos,ypos,coorsys)
84
+ end
85
+
86
+ # Convert World Coordinates to pixel coordinates
87
+ #
88
+ # @param [Float] xpos Longitude/Right Ascension in degrees
89
+ # @param [Float] ypos Latitude/Declination in degrees
90
+ # @return [[xpix,ypix,offscl]]
91
+ # * xpix: Image horizontal coordinate in pixels
92
+ # * ypix: Image vertical coordinate in pixels
93
+ # * offscl: 0 if within bounds, else off scale
94
+ def wcs2pix(xpos,ypos)
95
+ end
96
+
97
+ # Change center of WCS
98
+ #
99
+ # @param [Float] cra New center right ascension in degrees
100
+ # @param [Float] cdec New center declination in degrees
101
+ # @param [String] coorsys FK4 or FK5 coordinates (1950 or 2000)
102
+ # @return [nil]
103
+ def wcsshift(cra,cdec,coorsys)
104
+ # This function is defined in C
105
+ end
106
+
107
+ # Return RA and Dec of image center, size in degrees
108
+ #
109
+ # @return [[ra,dec,width,height]]
110
+ # * ra: Right ascension of image center (deg)
111
+ # * dec: Declination of image center (deg)
112
+ # * width: Width in degrees
113
+ # * height: Height in degrees
114
+ def wcsfull
115
+ # This function is defined in C
116
+ end
117
+
118
+ # Print the image center and size in WCS units
119
+ # @return [nil]
120
+ def wcscent
121
+ end
122
+
123
+ # Return image center and size in RA and Dec
124
+ #
125
+ # @return [[cra,cdec,ora,odec]]
126
+ # * cra: Right ascension of image center (deg)
127
+ # * cdec: Declination of image center (deg)
128
+ # * dra: Half-width in right ascension (deg)
129
+ # * ddec: Half-width in declination (deg)
130
+ def wcssize
131
+ # This function is defined in C
132
+ end
133
+
134
+ # Return min and max RA and Dec of image in degrees
135
+ #
136
+ # @return [[ra1,ra2,dec1,dec1]]
137
+ # * ra1: Min. right ascension of image (deg)
138
+ # * ra2: Max. right ascension of image (deg)
139
+ # * dec1: Min. declination of image (deg)
140
+ # * dec2: Max. declination of image (deg)
141
+ def wcsrange
142
+ # This function is defined in C
143
+ end
144
+
145
+ # Set scaling and rotation from CD matrix
146
+ #
147
+ # @param [Array] cd CD matrix, (2x2 array) ignored if NULL
148
+ # @return [nil]
149
+ def wcscdset(cd)
150
+ # This function is defined in C
151
+ end
152
+
153
+ # set scaling, rotation from CDELTi, CROTA2
154
+ #
155
+ # @param [Float] cdelt1 degrees/pixel in first axis (or both axes)
156
+ # @param [Float] cdelt2 degrees/pixel in second axis if nonzero
157
+ # @param [Float] crota Rotation counterclockwise in degrees
158
+ # @return [nil]
159
+ def wcsdeltset(cdelt1,cdelt2,crota)
160
+ # This function is defined in C
161
+ end
162
+
163
+ # set scaling, rotation from CDELTs and PC matrix
164
+ #
165
+ # @param [Float] cdelt1 degrees/pixel in first axis (or both axes)
166
+ # @param [Float] cdelt2 degrees/pixel in second axis if nonzero
167
+ # @param [Array] pc Rotation matrix, ignored if NULL
168
+ def wcspcset(cdelt1,cdelt2,pc)
169
+ # This function is defined in C
170
+ end
171
+
172
+ # @return [String] name of image coordinate system
173
+ def getradecsys
174
+ end
175
+
176
+ # Set output coordinate system for pix2wcs
177
+ #
178
+ # @param [String] coorsys Coordinate system (B1950, J2000, etc)
179
+ # @return [nil]
180
+ def wcsoutinit(coorsys)
181
+ # This function is defined in C
182
+ end
183
+
184
+ # @return [String] Return current output coordinate system
185
+ def getwcsout
186
+ end
187
+
188
+ # Set input coordinate system for wcs2pix
189
+ #
190
+ # @param [String] coorsys Coordinate system (B1950, J2000, etc)
191
+ # @return [nil]
192
+ def wcsininit(coorsys)
193
+ # This function is defined in C
194
+ end
195
+
196
+ # @return [String] Return current input coordinate system
197
+ def getwcsin
198
+ end
199
+
200
+ # Set WCS coordinate output format
201
+ #
202
+ # @param [Integer] degout 1= degrees, 0= hh:mm:ss dd:mm:ss
203
+ # @return [Integer]
204
+ def setwcsdeg(degout)
205
+ # This function is defined in C
206
+ end
207
+
208
+ # Set or get number of output decimal places
209
+ #
210
+ # @param [Integer] ndec Number of decimal places in output string. if < 0, return current ndec unchanged
211
+ def wcsndec
212
+ end
213
+
214
+ # Change WCS using arguments
215
+ #
216
+ # @param [Float] crpix1 Horizontal reference pixel
217
+ # @param [Float] crpix2 Vertical reference pixel
218
+ # @param [Float] crval1 Reference pixel horizontal coordinate in degrees
219
+ # @param [Float] crval2 Reference pixel vertical coordinate in degrees
220
+ # @param [Float] cdelt1 Horizontal scale in degrees/pixel, ignored if cd is not NULL
221
+ # @param [Float] cdelt2 Vertical scale in degrees/pixel, ignored if cd is not NULL
222
+ # @param [Float] crota Rotation angle in degrees, ignored if cd is not NULL
223
+ # @param [Array] cd Rotation matrix, used if not NULL
224
+ # @return [Integer]
225
+ def wcsreset(crpix1,crpix2,crval1,crval2,cdelt1,cdelt2,crota,cd)
226
+ # This function is defined in C
227
+ end
228
+
229
+ # Change equinox of reference pixel coordinates in WCS
230
+ #
231
+ # @param [Float] equinox Desired equinox as fractional year
232
+ # @return [nil]
233
+ def wcseqset(equinox)
234
+ # This function is defined in C
235
+ end
236
+
237
+ # Set pix2wcst() mode for LINEAR coordinates
238
+ #
239
+ # @param [Integer] mode 0: x y linear, 1: x units x units, 2: x y linear units
240
+ # @return [Integer]
241
+ def setwcslin(mode)
242
+ end
243
+
244
+ # Return coordinate in third dimension
245
+ #
246
+ # @return [Integer]
247
+ def wcszout
248
+ # This function is defined in C
249
+ end
250
+
251
+ end # WorldCoor
252
+
253
+ module_function
254
+
255
+ # Compute angular distance between 2 sky positions
256
+ #
257
+ # @param [Float] ra1 First longitude/right ascension in degrees
258
+ # @param [Float] dec1 First latitude/declination in degrees
259
+ # @param [Float] ra2 Second longitude/right ascension in degrees
260
+ # @param [Float] dec2 Second latitude/declination in degrees
261
+ # @return [Float]
262
+ def wcsdist(ra1,dec1,ra2,dec2)
263
+ # This function is defined in C
264
+ end
265
+
266
+ # Compute angular distance between 2 sky positions
267
+ #
268
+ # @param [Float] ra1 First longitude/right ascension in degrees
269
+ # @param [Float] dec1 First latitude/declination in degrees
270
+ # @param [Float] ra2 Second longitude/right ascension in degrees
271
+ # @param [Float] dec2 Second latitude/declination in degrees
272
+ # @return [Float]
273
+ def wcsdiff(ra1,dec1,ra2,dec2)
274
+ # This function is defined in C
275
+ end
276
+
277
+ # Set WCS error message for later printing
278
+ #
279
+ # @param [String] errmsg Error mesage < 80 char
280
+ # @return [nil]
281
+ def setwcserr(errmsg)
282
+ # This function is defined in C
283
+ end
284
+
285
+ # Print WCS error message to stderr
286
+ # @return [nil]
287
+ def wcserr
288
+ end
289
+
290
+ # Set flag to use AIPS WCS instead of WCSLIB
291
+ #
292
+ # @param [Integer] oldwcs 1 for AIPS WCS subroutines, else WCSLIB
293
+ # @return [nil]
294
+ def setdefwcs(oldwcs)
295
+ # This function is defined in C
296
+ end
297
+
298
+ # Return flag for AIPS WCS set by setdefwcs
299
+ # @return [Integer]
300
+ def getdefwcs
301
+ end
302
+
303
+ # Set third dimension for cube projections
304
+ #
305
+ # @param [Integer] izpix Set coordinate in third dimension (face)
306
+ # @return [Integer]
307
+ def wcszin(izpix)
308
+ # This function is defined in C
309
+ end
310
+
311
+ # Set filename for WCS error message
312
+ #
313
+ # @param [String] filename FITS or IRAF file name
314
+ # @return [nil]
315
+ def setwcsfile(filename)
316
+ # This function is defined in C
317
+ end
318
+
319
+
320
+ # Save output coordinate system
321
+ #
322
+ # @param [String] wcscoor coordinate system (J2000, B1950, galactic)
323
+ # @return [nil]
324
+ def savewcscoor(wcscoor)
325
+ # This function is defined in C
326
+ end
327
+
328
+ # Return output coordinate system
329
+ # @return [String]
330
+ def getwcscoor
331
+ end
332
+
333
+ # Convert from coordinate system sys1 to coordinate system sys2, converting
334
+ # proper motions, too, and adding them if an epoch is specified
335
+ #
336
+ # @param [Integer] sys1 Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC
337
+ # @param [Integer] sys2 Output coordinate system (J2000, B1950, ECLIPTIC, G ALACTIC
338
+ # @param [Float] eq1 Input equinox (default of sys1 if 0.0)
339
+ # @param [Float] eq2 Output equinox (default of sys2 if 0.0)
340
+ # @param [Float] ep1 Input Besselian epoch in years
341
+ # @param [Float] ep2 Output Besselian epoch in years
342
+ # @param [Float] dtheta Longitude or right ascension in degrees in sys1
343
+ # @param [Float] dphi Latitude or declination in degrees in sys1
344
+ # @param [Float] ptheta Longitude or right ascension proper motion in deg/year in sys1
345
+ # @param [Float] pphi Latitude or declination proper motion in deg/year
346
+ # @param [Float] px Parallax in arcseconds
347
+ # @param [Float] rv Radial velocity in km/sec
348
+ # @return [[dtheta,dphi,ptheta,pphi,px,rv]]
349
+ # * dtheta: Longitude or right ascension in degrees in sys1
350
+ # * dphi: Latitude or declination in degrees in sys1
351
+ # * ptheta: Longitude or right ascension proper motion in deg/year in sys1
352
+ # * pphi: Latitude or declination proper motion in deg/year
353
+ # * px: Parallax in arcseconds
354
+ # * rv: Radial velocity in km/sec
355
+ def wcsconv(sys1,sys2,eq1,eq2,ep1,ep2,dtheta,dphi,ptheta,pphi,px,rv)
356
+ # This function is defined in C
357
+ end
358
+
359
+ # Convert from coordinate system sys1 to coordinate system sys2, converting
360
+ # proper motions, too, and adding them if an epoch is specified
361
+ #
362
+ # @param [Integer] sys1 Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC
363
+ # @param [Integer] sys2 Output coordinate system (J2000, B1950, ECLIPTIC, GALACTIC
364
+ # @param [Float] eq1 Input equinox (default of sys1 if 0.0)
365
+ # @param [Float] eq2 Output equinox (default of sys2 if 0.0)
366
+ # @param [Float] ep1 Input Besselian epoch in years (for proper motion)
367
+ # @param [Float] ep2 Output Besselian epoch in years (for proper motion)
368
+ # @param [Float] dtheta Longitude or right ascension in degrees
369
+ # @param [Float] dphi Latitude or declination in degrees
370
+ # @param [Float] ptheta Longitude or right ascension proper motion in RA degrees/yea
371
+ # @param [Float] pphi Latitude or declination proper motion in Dec degrees/year
372
+ # @return [[dtheta,dphi,ptheta,pphi]]
373
+ # * dtheta: Longitude or right ascension in degrees
374
+ # * dphi: Latitude or declination in degrees
375
+ # * ptheta: Longitude or right ascension proper motion in RA degrees/yea
376
+ # * pphi: Latitude or declination proper motion in Dec degrees/year
377
+ def wcsconp(sys1,sys2,eq1,eq2,ep1,ep2,dtheta,dphi,ptheta,pphi);
378
+ end
379
+
380
+ # Convert between coordinate systems and equinoxes
381
+ #
382
+ # @param [Integer] sys1 Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC
383
+ # @param [Integer] sys2 Output coordinate system (J2000, B1950, ECLIPTIC, G ALACTIC
384
+ # @param [Float] eq1 Input equinox (default of sys1 if 0.0)
385
+ # @param [Float] eq2 Output equinox (default of sys2 if 0.0)
386
+ # @param [Float] dtheta Longitude or right ascension in degrees
387
+ # @param [Float] dphi Latitude or declination in degrees
388
+ # @param [Float] epoch Besselian epoch in years
389
+ # @return [[dtheta,dphi]]
390
+ # * dtheta: Longitude or right ascension in degrees
391
+ # * dphi: Latitude or declination in degrees
392
+ def wcscon(sys1,sys2,eq1,eq2,dtheta,dphi,epoch)
393
+ # This function is defined in C
394
+ end
395
+
396
+ # Convert B1950(FK4) to J2000(FK5) coordinates
397
+ #
398
+ # @param [Float] ra Right ascension in degrees (B1950 in, J2000 out)
399
+ # @param [Float] dec Declination in degrees (B1950 in, J2000 out)
400
+ # @param [Float] epoch Besselian epoch in years
401
+ # @return [[ra,dec]]
402
+ def fk425e(ra,dec,epoch)
403
+ # This function is defined in C
404
+ end
405
+
406
+ # Convert J2000(FK5) to B1950(FK4) coordinates
407
+ #
408
+ # @param [Float] ra Right ascension in degrees (J2000 in, B1950 out)
409
+ # @param [Float] dec Declination in degrees (J2000 in, B1950 out)
410
+ # @param [Float] epoch Besselian epoch in years
411
+ # @return [[ra,dec]]
412
+ def fk524e(ra,dec,epoch)
413
+ # This function is defined in C
414
+ end
415
+
416
+ # Return code for coordinate system in string
417
+ #
418
+ # @param [String] coorsys Coordinate system (B1950, J2000, etc)
419
+ # @return [Integer]
420
+ def wcscsys(coorsys)
421
+ # This function is defined in C
422
+ end
423
+
424
+ # Set equinox from string
425
+ #
426
+ # @param [String] wcstring_in Coordinate system (B1950, J2000, etc)
427
+ # @return [Float] return 0.0 if not obvious
428
+ def wcsceq(wcstring_in)
429
+ # This function is defined in C
430
+ end
431
+
432
+ # Set coordinate system type string from system and equinox
433
+ #
434
+ # @param [Integer] syswcs Coordinate system code
435
+ # @param [Float] equinox Equinox of coordinate system
436
+ # @param [Float] epoch Epoch of coordinate system
437
+ # @return [String] Coordinate system string
438
+ def wcscstr(cstr,syswcs,equinox,epoch)
439
+ # This function is defined in C
440
+ end
441
+
442
+ # Convert RA and Dec in degrees and distance to vector
443
+ #
444
+ # @param [Float] ra Right ascension in degrees
445
+ # @param [Float] dec Declination in degrees
446
+ # @param [Float] r Distance to object in same units as pos
447
+ # @return [[x,y,z]] x,y,z geocentric equatorial position of object
448
+ def d2v3(ra,dec,r)
449
+ # This function is defined in C
450
+ end
451
+
452
+ # Convert RA and Dec in radians and distance to vector
453
+ #
454
+ # @param [Float] ra Right ascension in radians
455
+ # @param [Float] dec Declination in radians
456
+ # @param [Float] r Distance to object in same units as pos
457
+ # @return [[x,y,z]] x,y,z geocentric equatorial position of object
458
+ def s2v3(ra,dec,r)
459
+ # This function is defined in C
460
+ end
461
+
462
+ # Convert vector to RA and Dec in degrees and distance
463
+ #
464
+ # @param [Array] pos x,y,z geocentric equatorial position of object
465
+ # @return [[ra,dec,r]]
466
+ # * ra: Right ascension in degrees
467
+ # * dec: Declination in degrees
468
+ # * r: Distance to object in same units as pos
469
+ def v2d3(pos)
470
+ # This function is defined in C
471
+ end
472
+
473
+ # Convert vector to RA and Dec in radians and distance
474
+ #
475
+ # @param [Array] pos x,y,z geocentric equatorial position of object
476
+ # @return [[ra,dec,r]]
477
+ # * ra: Right ascension in radians
478
+ # * dec: Declination in radians
479
+ # * r: Distance to object in same units as pos
480
+ def v2s3(pos)
481
+ # This function is defined in C
482
+ end
483
+
484
+ end