wcs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/COPYING +339 -0
- data/Gemfile +4 -0
- data/README.md +77 -0
- data/Rakefile +1 -0
- data/ext/depend +2 -0
- data/ext/extconf.rb +12 -0
- data/ext/wcs.i +578 -0
- data/ext/wcs_h.i +178 -0
- data/ext/wcs_wrap.c +11289 -0
- data/lib/wcs/version.rb +3 -0
- data/libdoc.rb +484 -0
- data/setup.rb +1585 -0
- data/spec/wcs_spec.rb +621 -0
- data/test.rb +112 -0
- data/wcs.gemspec +36 -0
- metadata +108 -0
data/test.rb
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
require "wcs"
|
2
|
+
|
3
|
+
# int naxis1, /* Number of pixels along x-axis */
|
4
|
+
# int naxis2, /* Number of pixels along y-axis */
|
5
|
+
# char *ctype1, /* FITS WCS projection for axis 1 */
|
6
|
+
# char *ctype2, /* FITS WCS projection for axis 2 */
|
7
|
+
# double crpix1, /* Reference pixel coordinates */
|
8
|
+
# double crpix2, /* Reference pixel coordinates */
|
9
|
+
# double crval1, /* Coordinate at reference pixel in degrees */
|
10
|
+
# double crval2, /* Coordinate at reference pixel in degrees */
|
11
|
+
# double *cd, /* Rotation matrix, used if not NULL */
|
12
|
+
# double cdelt1, /* scale in degrees/pixel, if cd is NULL */
|
13
|
+
# double cdelt2, /* scale in degrees/pixel, if cd is NULL */
|
14
|
+
# double crota, /* Rotation angle in degrees, if cd is NULL */
|
15
|
+
# int equinox, /* Equinox of coordinates, 1950 and 2000 supported */
|
16
|
+
# double epoch); /* Epoch of coordinates, for FK4/FK5 conversion */
|
17
|
+
|
18
|
+
naxis1 = 100 # /* Number of pixels along x-axis */
|
19
|
+
naxis2 = 100 # /* Number of pixels along y-axis */
|
20
|
+
ctype1 = "RA--TAN" # /* FITS WCS projection for axis 1 */
|
21
|
+
ctype2 = "DEC-TAN" # /* FITS WCS projection for axis 2 */
|
22
|
+
crpix1 = 0 # /* Reference pixel coordinates */
|
23
|
+
crpix2 = 0 # /* Reference pixel coordinates */
|
24
|
+
crval1 = 0 # /* Coordinate at reference pixel in degrees */
|
25
|
+
crval2 = 0 # /* Coordinate at reference pixel in degrees */
|
26
|
+
cd = nil # /* Rotation matrix, used if not NULL */
|
27
|
+
cdelt1 = 0.1 # /* scale in degrees/pixel, if cd is NULL */
|
28
|
+
cdelt2 = 0.1 # /* scale in degrees/pixel, if cd is NULL */
|
29
|
+
crota = 0 # /* Rotation angle in degrees, if cd is NULL */
|
30
|
+
equinox = 2000 # /* Equinox of coordinates, 1950 and 2000 supported */
|
31
|
+
epoch = 2000 # /* Epoch of coordinates, for FK4/FK5 conversion */
|
32
|
+
|
33
|
+
wcs = Wcs::WorldCoor.new(
|
34
|
+
naxis1, # /* Number of pixels along x-axis */
|
35
|
+
naxis2, # /* Number of pixels along y-axis */
|
36
|
+
ctype1, # /* FITS WCS projection for axis 1 */
|
37
|
+
ctype2, # /* FITS WCS projection for axis 2 */
|
38
|
+
crpix1, # /* Reference pixel coordinates */
|
39
|
+
crpix2, # /* Reference pixel coordinates */
|
40
|
+
crval1, # /* Coordinate at reference pixel in degrees */
|
41
|
+
crval2, # /* Coordinate at reference pixel in degrees */
|
42
|
+
cd, # /* Rotation matrix, used if not NULL */
|
43
|
+
cdelt1, # /* scale in degrees/pixel, if cd is NULL */
|
44
|
+
cdelt2, # /* scale in degrees/pixel, if cd is NULL */
|
45
|
+
crota, # /* Rotation angle in degrees, if cd is NULL */
|
46
|
+
equinox,# /* Equinox of coordinates, 1950 and 2000 supported */
|
47
|
+
epoch) # /* Epoch of coordinates, for FK4/FK5 conversion */
|
48
|
+
|
49
|
+
=begin
|
50
|
+
void wcs2pix ( /* Convert World Coordinates to pixel coordinates */
|
51
|
+
struct WorldCoor *wcs, /* World coordinate system structure */
|
52
|
+
double xpos, /* Longitude/Right Ascension in degrees */
|
53
|
+
double ypos, /* Latitude/Declination in degrees */
|
54
|
+
double *xpix, /* Image horizontal coordinate in pixels (returned) */
|
55
|
+
double *ypix, /* Image vertical coordinate in pixels (returned) */
|
56
|
+
int *offscl);
|
57
|
+
|
58
|
+
void pix2wcs ( /* Convert pixel coordinates to World Coordinates */
|
59
|
+
struct WorldCoor *wcs, /* World coordinate system structure */
|
60
|
+
double xpix, /* Image horizontal coordinate in pixels */
|
61
|
+
double ypix, /* Image vertical coordinate in pixels */
|
62
|
+
double *xpos, /* Longitude/Right Ascension in degrees (returned) */
|
63
|
+
double *ypos); /* Latitude/Declination in degrees (returned) */
|
64
|
+
=end
|
65
|
+
|
66
|
+
p wcs
|
67
|
+
p wcs.wcs2pix(0.5,0.5)
|
68
|
+
p wcs.pix2wcs(50,50)
|
69
|
+
|
70
|
+
|
71
|
+
=begin
|
72
|
+
void wcscon( /* Convert between coordinate systems and equinoxes */
|
73
|
+
int sys1, /* Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
|
74
|
+
int sys2, /* Output coordinate system (J2000, B1950, ECLIPTIC, G ALACTIC */
|
75
|
+
double eq1, /* Input equinox (default of sys1 if 0.0) */
|
76
|
+
double eq2, /* Output equinox (default of sys2 if 0.0) */
|
77
|
+
double *dtheta, /* Longitude or right ascension in degrees
|
78
|
+
Input in sys1, returned in sys2 */
|
79
|
+
double *dphi, /* Latitude or declination in degrees
|
80
|
+
Input in sys1, returned in sys2 */
|
81
|
+
double epoch); /* Besselian epoch in years */
|
82
|
+
=end
|
83
|
+
alpha = 0
|
84
|
+
delta = 0
|
85
|
+
p Wcs.wcscon(Wcs::J2000,Wcs::GALACTIC,0,0,alpha,delta,2000)
|
86
|
+
|
87
|
+
|
88
|
+
hstr="
|
89
|
+
SIMPLE = T
|
90
|
+
BITPIX = -64
|
91
|
+
NAXIS = 2
|
92
|
+
NAXIS1 = 10000
|
93
|
+
NAXIS2 = 10000
|
94
|
+
CTYPE1 = 'RA---TAN'
|
95
|
+
CTYPE2 = 'DEC--TAN'
|
96
|
+
EQUINOX = 2000
|
97
|
+
CRVAL1 = 10.685497001
|
98
|
+
CRVAL2 = 41.270525148
|
99
|
+
CDELT1 = -0.000277780
|
100
|
+
CDELT2 = 0.000277780
|
101
|
+
CRPIX1 = 5000.0000
|
102
|
+
CRPIX2 = 5000.0000
|
103
|
+
CROTA2 = 0.0
|
104
|
+
END
|
105
|
+
"
|
106
|
+
hstr = hstr.split(/\n/).map{|x| x+" "*(80-x.size)}.join("")
|
107
|
+
wcs = Wcs::WorldCoor.new(hstr)
|
108
|
+
p wcs
|
109
|
+
p wcs.wcs2pix(0.5,0.5)
|
110
|
+
p wcs.pix2wcs(50,50)
|
111
|
+
|
112
|
+
p wcs.pix2wcst(50,50)
|
data/wcs.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'wcs/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "wcs"
|
8
|
+
spec.version = Wcs::VERSION
|
9
|
+
spec.authors = ["Masahiro TANAKA"]
|
10
|
+
spec.email = ["masa16.tanaka@gmail.com"]
|
11
|
+
spec.description = %q{WCSTools wrapper for Ruby. Provides calculation and conversion of sky positions in astronomical coordinates.}
|
12
|
+
spec.summary = %q{WCSTools wrapper for Ruby. Provides calculation and conversion of sky positions in astronomical coordinates.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.extensions = ["ext/extconf.rb"]
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
# spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
|
25
|
+
spec.rdoc_options = %w[
|
26
|
+
libdoc.rb
|
27
|
+
--exclude doc/
|
28
|
+
--exclude lib/wcs.so
|
29
|
+
--exclude ext/
|
30
|
+
--exclude setup
|
31
|
+
--exclude gemspec
|
32
|
+
--exclude Gemfile
|
33
|
+
--exclude Rakefile
|
34
|
+
]
|
35
|
+
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wcs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masahiro TANAKA
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: WCSTools wrapper for Ruby. Provides calculation and conversion of sky
|
42
|
+
positions in astronomical coordinates.
|
43
|
+
email:
|
44
|
+
- masa16.tanaka@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions:
|
47
|
+
- ext/extconf.rb
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- .gitignore
|
51
|
+
- COPYING
|
52
|
+
- Gemfile
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- ext/depend
|
56
|
+
- ext/extconf.rb
|
57
|
+
- ext/wcs.i
|
58
|
+
- ext/wcs_h.i
|
59
|
+
- ext/wcs_wrap.c
|
60
|
+
- lib/wcs/version.rb
|
61
|
+
- libdoc.rb
|
62
|
+
- setup.rb
|
63
|
+
- spec/wcs_spec.rb
|
64
|
+
- test.rb
|
65
|
+
- wcs.gemspec
|
66
|
+
homepage: ''
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options:
|
72
|
+
- libdoc.rb
|
73
|
+
- --exclude
|
74
|
+
- doc/
|
75
|
+
- --exclude
|
76
|
+
- lib/wcs.so
|
77
|
+
- --exclude
|
78
|
+
- ext/
|
79
|
+
- --exclude
|
80
|
+
- setup
|
81
|
+
- --exclude
|
82
|
+
- gemspec
|
83
|
+
- --exclude
|
84
|
+
- Gemfile
|
85
|
+
- --exclude
|
86
|
+
- Rakefile
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.0.0
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: WCSTools wrapper for Ruby. Provides calculation and conversion of sky positions
|
105
|
+
in astronomical coordinates.
|
106
|
+
test_files:
|
107
|
+
- spec/wcs_spec.rb
|
108
|
+
has_rdoc:
|