wcs 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -20
- data/ext/extconf.rb +1 -1
- data/ext/wcs.i +4 -4
- data/lib/wcs/libdoc.rb +23 -22
- data/lib/wcs/version.rb +1 -1
- data/spec/wcs_spec.rb +14 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89d7dbd8514f7a4f6fd22f306752695a0720b02b
|
4
|
+
data.tar.gz: 2da1e5bf5bb64587115113b4c75bfe4f8411f3e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 381d726a63269a6da7cf657fbfcd57366a124e7803b24b74ce0a90806c358f56a8637a71fc74508be64f96eac0929013ed42d87e51e3abea1cc78eb9b7f1d497
|
7
|
+
data.tar.gz: d6a39cec4ae74a70f0db97cc78e9db3124fd5a937e91c756d490aecf7fb35ff432555dc157f379d6e26f4e07d906374dfdae59f2d69dc4b65024179177908299
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Ruby/WCS
|
2
2
|
|
3
|
-
[WCSTools](http://tdc-www.harvard.edu/wcstools/)
|
3
|
+
Ruby wrapper of [WCSTools](http://tdc-www.harvard.edu/wcstools/) using SWIG.
|
4
4
|
Provides calculation and conversion of sky positions in astronomical coordinates.
|
5
5
|
|
6
|
+
This is **NOT** [WCSLIB](http://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/) wrapper.
|
7
|
+
|
6
8
|
* [GitHub](https://github.com/masa16/ruby-wcs)
|
7
9
|
* [RubyGems](https://rubygems.org/gems/wcs)
|
8
10
|
* [Class Documentation](http://rubydoc.info/gems/wcs/frames/)
|
@@ -35,30 +37,37 @@ Provides calculation and conversion of sky positions in astronomical coordinates
|
|
35
37
|
## Usage
|
36
38
|
|
37
39
|
require 'wcs'
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
40
|
+
|
41
|
+
ra = 0
|
42
|
+
dec = 0
|
43
|
+
l,b = Wcs.wcscon(Wcs::J2000,Wcs::GALACTIC,0,0,ra,dec,2000)
|
44
|
+
#=> [96.33726964987589, -60.188551749437046]
|
45
|
+
|
46
|
+
naxis1 = 100 # Number of pixels along x-axis
|
47
|
+
naxis2 = 100 # Number of pixels along y-axis
|
48
|
+
ctype1 = "RA--TAN" # FITS WCS projection for axis 1
|
49
|
+
ctype2 = "DEC-TAN" # FITS WCS projection for axis 2
|
50
|
+
crpix1 = 0 # Reference pixel coordinates
|
51
|
+
crpix2 = 0 # Reference pixel coordinates
|
52
|
+
crval1 = 0 # Coordinate at reference pixel in degrees
|
53
|
+
crval2 = 0 # Coordinate at reference pixel in degrees
|
54
|
+
cd = nil # Rotation matrix, used if not NULL
|
55
|
+
cdelt1 = 0.1 # scale in degrees/pixel, if cd is NULL
|
56
|
+
cdelt2 = 0.1 # scale in degrees/pixel, if cd is NULL
|
57
|
+
crota = 0 # Rotation angle in degrees, if cd is NULL
|
58
|
+
equinox = 2000 # Equinox of coordinates, 1950 and 2000 supported
|
59
|
+
epoch = 2000 # Epoch of coordinates, for FK4/FK5 conversion
|
52
60
|
|
53
61
|
wcs = Wcs::WorldCoor.new(naxis1,naxis2,ctype1,ctype2,
|
54
62
|
crpix1,crpix2,crval1,crval2,cd,cdelt1,cdelt2,
|
55
63
|
crota,equinox,epoch)
|
56
|
-
xpix,ypix = wcs.wcs2pix(0.5,0.5)
|
57
|
-
xpos,ypos = wcs.pix2wcs(50,50)
|
58
64
|
|
59
|
-
|
60
|
-
|
61
|
-
|
65
|
+
xpix,ypix,offscl = wcs.wcs2pix(0.5,0.5)
|
66
|
+
#=> [5.000126927791313, 5.000317324553201, 0]
|
67
|
+
|
68
|
+
xpos,ypos = wcs.pix2wcs(12,34)
|
69
|
+
#=> [1.1998245865308625, 3.395274673610471]
|
70
|
+
|
62
71
|
|
63
72
|
## Platforms tested
|
64
73
|
|
data/ext/extconf.rb
CHANGED
data/ext/wcs.i
CHANGED
@@ -415,10 +415,10 @@ typedef int BOOLEAN;
|
|
415
415
|
// char **header, /* Pointer to start of FITS header */
|
416
416
|
// char *cwcs); /* Keyword suffix character for output WCS */
|
417
417
|
|
418
|
-
void savewcscoor( /* Save output coordinate system */
|
419
|
-
char *wcscoor); /* coordinate system (J2000, B1950, galactic) */
|
420
|
-
|
421
|
-
char *getwcscoor(void); /* Return output coordinate system */
|
418
|
+
// void savewcscoor( /* Save output coordinate system */
|
419
|
+
// char *wcscoor); /* coordinate system (J2000, B1950, galactic) */
|
420
|
+
//
|
421
|
+
// char *getwcscoor(void); /* Return output coordinate system */
|
422
422
|
|
423
423
|
|
424
424
|
/* Coordinate conversion subroutines in wcscon.c */
|
data/lib/wcs/libdoc.rb
CHANGED
@@ -122,11 +122,11 @@ class WorldCoor
|
|
122
122
|
|
123
123
|
# Return image center and size in RA and Dec
|
124
124
|
#
|
125
|
-
# @return [[cra,cdec,
|
125
|
+
# @return [[cra,cdec,hwra,hwdec]]
|
126
126
|
# * cra: Right ascension of image center (deg)
|
127
127
|
# * cdec: Declination of image center (deg)
|
128
|
-
# *
|
129
|
-
# *
|
128
|
+
# * hwra: Half-width in right ascension (deg)
|
129
|
+
# * hwdec: Half-width in declination (deg)
|
130
130
|
def wcssize
|
131
131
|
# This function is defined in C
|
132
132
|
end
|
@@ -165,6 +165,7 @@ class WorldCoor
|
|
165
165
|
# @param [Float] cdelt1 degrees/pixel in first axis (or both axes)
|
166
166
|
# @param [Float] cdelt2 degrees/pixel in second axis if nonzero
|
167
167
|
# @param [Array] pc Rotation matrix, ignored if NULL
|
168
|
+
# @return [nil]
|
168
169
|
def wcspcset(cdelt1,cdelt2,pc)
|
169
170
|
# This function is defined in C
|
170
171
|
end
|
@@ -303,7 +304,7 @@ class WorldCoor
|
|
303
304
|
# Set third dimension for cube projections
|
304
305
|
#
|
305
306
|
# @param [Integer] izpix Set coordinate in third dimension (face)
|
306
|
-
# @return [Integer]
|
307
|
+
# @return [Integer] saved izpix
|
307
308
|
def wcszin(izpix)
|
308
309
|
# This function is defined in C
|
309
310
|
end
|
@@ -317,24 +318,24 @@ class WorldCoor
|
|
317
318
|
end
|
318
319
|
|
319
320
|
|
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
|
321
|
+
# # Save output coordinate system
|
322
|
+
# #
|
323
|
+
# # @param [String] wcscoor coordinate system (J2000, B1950, galactic)
|
324
|
+
# # @return [nil]
|
325
|
+
# def savewcscoor(wcscoor)
|
326
|
+
# # This function is defined in C
|
327
|
+
# end
|
328
|
+
#
|
329
|
+
# # Return output coordinate system
|
330
|
+
# # @return [String]
|
331
|
+
# def getwcscoor
|
332
|
+
# end
|
332
333
|
|
333
334
|
# Convert from coordinate system sys1 to coordinate system sys2, converting
|
334
335
|
# proper motions, too, and adding them if an epoch is specified
|
335
336
|
#
|
336
|
-
# @param [Integer] sys1 Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC
|
337
|
-
# @param [Integer] sys2 Output coordinate system (J2000, B1950, ECLIPTIC,
|
337
|
+
# @param [Integer] sys1 Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC)
|
338
|
+
# @param [Integer] sys2 Output coordinate system (J2000, B1950, ECLIPTIC, GALACTIC)
|
338
339
|
# @param [Float] eq1 Input equinox (default of sys1 if 0.0)
|
339
340
|
# @param [Float] eq2 Output equinox (default of sys2 if 0.0)
|
340
341
|
# @param [Float] ep1 Input Besselian epoch in years
|
@@ -359,8 +360,8 @@ class WorldCoor
|
|
359
360
|
# Convert from coordinate system sys1 to coordinate system sys2, converting
|
360
361
|
# proper motions, too, and adding them if an epoch is specified
|
361
362
|
#
|
362
|
-
# @param [Integer] sys1 Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC
|
363
|
-
# @param [Integer] sys2 Output coordinate system (J2000, B1950, ECLIPTIC, GALACTIC
|
363
|
+
# @param [Integer] sys1 Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC)
|
364
|
+
# @param [Integer] sys2 Output coordinate system (J2000, B1950, ECLIPTIC, GALACTIC)
|
364
365
|
# @param [Float] eq1 Input equinox (default of sys1 if 0.0)
|
365
366
|
# @param [Float] eq2 Output equinox (default of sys2 if 0.0)
|
366
367
|
# @param [Float] ep1 Input Besselian epoch in years (for proper motion)
|
@@ -379,8 +380,8 @@ class WorldCoor
|
|
379
380
|
|
380
381
|
# Convert between coordinate systems and equinoxes
|
381
382
|
#
|
382
|
-
# @param [Integer] sys1 Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC
|
383
|
-
# @param [Integer] sys2 Output coordinate system (J2000, B1950, ECLIPTIC,
|
383
|
+
# @param [Integer] sys1 Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC)
|
384
|
+
# @param [Integer] sys2 Output coordinate system (J2000, B1950, ECLIPTIC, GALACTIC)
|
384
385
|
# @param [Float] eq1 Input equinox (default of sys1 if 0.0)
|
385
386
|
# @param [Float] eq2 Output equinox (default of sys2 if 0.0)
|
386
387
|
# @param [Float] dtheta Longitude or right ascension in degrees
|
data/lib/wcs/version.rb
CHANGED
data/spec/wcs_spec.rb
CHANGED
@@ -406,20 +406,20 @@ describe "Wcs" do
|
|
406
406
|
end
|
407
407
|
|
408
408
|
|
409
|
-
# Save output coordinate system
|
410
|
-
#
|
411
|
-
# @param [String] wcscoor coordinate system (J2000, B1950, galactic)
|
412
|
-
# @return [String]
|
413
|
-
wcscoor = 'J2000'
|
414
|
-
describe Wcs.savewcscoor(wcscoor) do
|
415
|
-
it{should == ''}
|
416
|
-
end
|
417
|
-
|
418
|
-
# Return output coordinate system
|
419
|
-
# @return [String]
|
420
|
-
describe Wcs.getwcscoor do
|
421
|
-
it{should == 'J2000'}
|
422
|
-
end
|
409
|
+
# # Save output coordinate system
|
410
|
+
# #
|
411
|
+
# # @param [String] wcscoor coordinate system (J2000, B1950, galactic)
|
412
|
+
# # @return [String]
|
413
|
+
# wcscoor = 'J2000'
|
414
|
+
# describe Wcs.savewcscoor(wcscoor) do
|
415
|
+
# it{should == ''}
|
416
|
+
# end
|
417
|
+
#
|
418
|
+
# # Return output coordinate system
|
419
|
+
# # @return [String]
|
420
|
+
# describe Wcs.getwcscoor do
|
421
|
+
# it{should == 'J2000'}
|
422
|
+
# end
|
423
423
|
|
424
424
|
# Convert from coordinate system sys1 to coordinate system sys2, converting
|
425
425
|
# proper motions, too, and adding them if an epoch is specified
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro TANAKA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|