voruby 1.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. data/Rakefile.rb +107 -224
  2. data/lib/misc.rb +1 -0
  3. data/lib/misc/misc.rb +60 -0
  4. data/lib/misc/propertyfile.rb +31 -0
  5. data/lib/symphony.rb +1 -0
  6. data/lib/symphony/symphony.rb +247 -0
  7. data/lib/voruby.rb +186 -0
  8. data/lib/voruby/active_votable/active_votable.rb +468 -347
  9. data/lib/voruby/adql/1.0/adql.rb +2418 -0
  10. data/lib/voruby/adql/support.rb +2 -0
  11. data/lib/voruby/misc.rb +351 -0
  12. data/lib/voruby/misc/connection_monitor.rb +97 -0
  13. data/lib/voruby/misc/libxml_ext.rb +121 -0
  14. data/lib/voruby/misc/rexml_ext.rb +223 -0
  15. data/lib/voruby/resolver/resolver.rb +12 -0
  16. data/lib/voruby/resolver/sesame.rb +299 -0
  17. data/lib/voruby/sky_query/sky_query.rb +192 -0
  18. data/lib/voruby/stc/1.10/coords.rb +2272 -0
  19. data/lib/voruby/stc/1.10/region.rb +892 -0
  20. data/lib/voruby/stc/1.10/stc.rb +3271 -0
  21. data/lib/voruby/stc/1.30/stc.rb +8666 -0
  22. data/lib/voruby/stc/support.rb +2 -0
  23. data/lib/voruby/ucd/ucd.rb +173 -0
  24. data/lib/voruby/voevent/1.1/voevent.rb +1124 -0
  25. data/lib/voruby/voevent/support.rb +5 -0
  26. data/lib/voruby/votable/1.0/votable.rb +1807 -0
  27. data/lib/voruby/votable/1.1/votable.rb +2100 -0
  28. data/lib/voruby/votable/votable.rb +305 -0
  29. data/lib/voruby/wesix/wesix.rb +491 -0
  30. data/lib/voruby/xlink/1.2/xlink.rb +21 -0
  31. data/test/voruby/active_votable/complex.vot +60 -0
  32. data/test/voruby/active_votable/error.vot +6 -0
  33. data/test/voruby/active_votable/large.vot +130040 -0
  34. data/test/voruby/active_votable/simple1.vot +38 -0
  35. data/test/voruby/active_votable/simple2.vot +38 -0
  36. data/test/voruby/active_votable/test.rb +193 -0
  37. data/test/voruby/adql/1.0/adql-alias.sql +1 -0
  38. data/test/voruby/adql/1.0/adql-alias.xml +26 -0
  39. data/test/voruby/adql/1.0/adql-avg.sql +1 -0
  40. data/test/voruby/adql/1.0/adql-avg.xml +31 -0
  41. data/test/voruby/adql/1.0/adql-circle.sql +1 -0
  42. data/test/voruby/adql/1.0/adql-circle.xml +46 -0
  43. data/test/voruby/adql/1.0/adql-expr.sql +1 -0
  44. data/test/voruby/adql/1.0/adql-expr.xml +34 -0
  45. data/test/voruby/adql/1.0/adql-function.sql +1 -0
  46. data/test/voruby/adql/1.0/adql-function.xml +41 -0
  47. data/test/voruby/adql/1.0/adql-group.sql +1 -0
  48. data/test/voruby/adql/1.0/adql-group.xml +51 -0
  49. data/test/voruby/adql/1.0/adql-having.sql +1 -0
  50. data/test/voruby/adql/1.0/adql-having.xml +25 -0
  51. data/test/voruby/adql/1.0/adql-like.sql +1 -0
  52. data/test/voruby/adql/1.0/adql-like.xml +17 -0
  53. data/test/voruby/adql/1.0/adql-order.sql +1 -0
  54. data/test/voruby/adql/1.0/adql-order.xml +37 -0
  55. data/test/voruby/adql/1.0/adql-simple.sql +1 -0
  56. data/test/voruby/adql/1.0/adql-simple.xml +12 -0
  57. data/test/voruby/adql/1.0/adql-top.sql +1 -0
  58. data/test/voruby/adql/1.0/adql-top.xml +33 -0
  59. data/test/voruby/adql/1.0/test.rb +2220 -0
  60. data/test/voruby/misc/test.rb +32 -0
  61. data/test/voruby/resolver/sesame/test.rb +56 -0
  62. data/test/voruby/sky_query/test.rb +107 -0
  63. data/test/voruby/stc/1.10/coords_test.rb +3704 -0
  64. data/test/voruby/stc/1.10/region_test.rb +993 -0
  65. data/test/voruby/stc/1.10/stc-catalog-entry-location.xml +112 -0
  66. data/test/voruby/stc/1.10/stc-obs-data-location.xml +126 -0
  67. data/test/voruby/stc/1.10/stc-region-circle.xml +5 -0
  68. data/test/voruby/stc/1.10/stc-region-convex.xml +11 -0
  69. data/test/voruby/stc/1.10/stc-region-convexhull.xml +5 -0
  70. data/test/voruby/stc/1.10/stc-region-ellipse.xml +7 -0
  71. data/test/voruby/stc/1.10/stc-region-intersection.xml +25 -0
  72. data/test/voruby/stc/1.10/stc-region-negation.xml +7 -0
  73. data/test/voruby/stc/1.10/stc-region-polygon.xml +13 -0
  74. data/test/voruby/stc/1.10/stc-region-sector.xml +6 -0
  75. data/test/voruby/stc/1.10/stc-region-union.xml +25 -0
  76. data/test/voruby/stc/1.10/stc-resource-profile.xml +60 -0
  77. data/test/voruby/stc/1.10/stc-search-location.xml +54 -0
  78. data/test/voruby/stc/1.10/stc_test.rb +4626 -0
  79. data/test/voruby/stc/1.30/stc-catalog-entry-location.xml +210 -0
  80. data/test/voruby/stc/1.30/stc-obs-data-location-arecibo.xml +353 -0
  81. data/test/voruby/stc/1.30/stc-obs-data-location-fits.xml +250 -0
  82. data/test/voruby/stc/1.30/stc-obs-data-location-xlink.xml +63 -0
  83. data/test/voruby/stc/1.30/stc-obs-data-location.xml +216 -0
  84. data/test/voruby/stc/1.30/stc-resource-profile-unusual-ref-pos.xml +39 -0
  85. data/test/voruby/stc/1.30/stc-resource-profile.xml +129 -0
  86. data/test/voruby/stc/1.30/stc-search-location-arecibo.xml +86 -0
  87. data/test/voruby/stc/1.30/stc-search-location.xml +101 -0
  88. data/test/voruby/stc/1.30/test.rb +6274 -0
  89. data/test/voruby/ucd/test.rb +48 -0
  90. data/test/voruby/voevent/1.1/test.rb +812 -0
  91. data/test/{voevent/voevent_v1_1.xml → voruby/voevent/1.1/voevent.xml} +2 -2
  92. data/test/voruby/voregistry/0.3/test.rb +137 -0
  93. data/test/voruby/votable/1.0/test.rb +714 -0
  94. data/test/voruby/votable/1.0/votable.basic.xml +660 -0
  95. data/test/voruby/votable/1.0/votable.html +86 -0
  96. data/test/voruby/votable/1.0/votable.ns.xml +56 -0
  97. data/test/voruby/votable/1.1/test.rb +785 -0
  98. data/test/voruby/votable/1.1/votable.basic.xml +38 -0
  99. data/test/voruby/votable/1.1/votable.html +86 -0
  100. data/test/voruby/votable/1.1/votable.ns.xml +56 -0
  101. data/test/voruby/votable/test.rb +15 -0
  102. data/test/voruby/wesix/test.rb +268 -0
  103. data/test/voruby/wesix/testr.fits +28 -0
  104. metadata +234 -247
  105. data/REQUIREMENTS +0 -6
  106. data/lib/voruby/active_votable/loader.rb +0 -5
  107. data/lib/voruby/adql/adql.rb +0 -2787
  108. data/lib/voruby/adql/ext.rb +0 -14
  109. data/lib/voruby/adql/loader.rb +0 -6
  110. data/lib/voruby/adql/operations.rb +0 -54
  111. data/lib/voruby/adql/parser.rb +0 -160
  112. data/lib/voruby/adql/transforms.rb +0 -573
  113. data/lib/voruby/ext.rb +0 -17
  114. data/lib/voruby/loader.rb +0 -4
  115. data/lib/voruby/misc/propertyfile.rb +0 -36
  116. data/lib/voruby/plastic/applications.rb +0 -174
  117. data/lib/voruby/plastic/constants.rb +0 -30
  118. data/lib/voruby/plastic/loader.rb +0 -10
  119. data/lib/voruby/plastic/plastic.rb +0 -1
  120. data/lib/voruby/resources/conesearch/conesearch.rb +0 -9
  121. data/lib/voruby/resources/conesearch/conesearch_v0_2.rb +0 -55
  122. data/lib/voruby/resources/conesearch/conesearch_v0_3.rb +0 -50
  123. data/lib/voruby/resources/conesearch/conesearch_v1_0.rb +0 -72
  124. data/lib/voruby/resources/conesearch/loader.rb +0 -4
  125. data/lib/voruby/resources/loader.rb +0 -50
  126. data/lib/voruby/resources/nodes.rb +0 -190
  127. data/lib/voruby/resources/openskynode/loader.rb +0 -4
  128. data/lib/voruby/resources/openskynode/openskynode.rb +0 -9
  129. data/lib/voruby/resources/openskynode/openskynode_v0_1.rb +0 -54
  130. data/lib/voruby/resources/sia/loader.rb +0 -5
  131. data/lib/voruby/resources/sia/sia.rb +0 -9
  132. data/lib/voruby/resources/sia/sia_v0_6.rb +0 -90
  133. data/lib/voruby/resources/sia/sia_v0_7.rb +0 -89
  134. data/lib/voruby/resources/sia/sia_v1_0.rb +0 -122
  135. data/lib/voruby/resources/stsci.rb +0 -59
  136. data/lib/voruby/resources/vodataservice/coverage_v0_2.rb +0 -195
  137. data/lib/voruby/resources/vodataservice/coverage_v0_3.rb +0 -158
  138. data/lib/voruby/resources/vodataservice/loader.rb +0 -5
  139. data/lib/voruby/resources/vodataservice/vodataservice.rb +0 -9
  140. data/lib/voruby/resources/vodataservice/vodataservice_v0_4.rb +0 -189
  141. data/lib/voruby/resources/vodataservice/vodataservice_v0_5.rb +0 -163
  142. data/lib/voruby/resources/vodataservice/vodataservice_v1_0.rb +0 -221
  143. data/lib/voruby/resources/voregistry/loader.rb +0 -4
  144. data/lib/voruby/resources/voregistry/voregistry.rb +0 -9
  145. data/lib/voruby/resources/voregistry/voregistry_v0_2.rb +0 -40
  146. data/lib/voruby/resources/voregistry/voregistry_v0_3.rb +0 -30
  147. data/lib/voruby/resources/voregistry/voregistry_v1_0.rb +0 -86
  148. data/lib/voruby/resources/voresource/loader.rb +0 -17
  149. data/lib/voruby/resources/voresource/voresource.rb +0 -9
  150. data/lib/voruby/resources/voresource/voresource_v0_10.rb +0 -327
  151. data/lib/voruby/resources/voresource/voresource_v0_9.rb +0 -405
  152. data/lib/voruby/resources/voresource/voresource_v1_0.rb +0 -230
  153. data/lib/voruby/services/ext.rb +0 -11
  154. data/lib/voruby/services/gestalt/footprint.rb +0 -95
  155. data/lib/voruby/services/gestalt/wcs_fixer.rb +0 -105
  156. data/lib/voruby/services/gestalt/wesix.rb +0 -155
  157. data/lib/voruby/services/loader.rb +0 -7
  158. data/lib/voruby/services/registry/registry.rb +0 -53
  159. data/lib/voruby/services/resolver/resolver.rb +0 -35
  160. data/lib/voruby/services/schema/schema.rb +0 -644
  161. data/lib/voruby/sesame/loader.rb +0 -6
  162. data/lib/voruby/sesame/sesame_v1_0.rb +0 -64
  163. data/lib/voruby/simple/loader.rb +0 -6
  164. data/lib/voruby/simple/parameters.rb +0 -196
  165. data/lib/voruby/simple/sap.rb +0 -446
  166. data/lib/voruby/spacetime/loader.rb +0 -3
  167. data/lib/voruby/spacetime/spacetime.rb +0 -607
  168. data/lib/voruby/stc/coords_v1_20.rb +0 -900
  169. data/lib/voruby/stc/loader.rb +0 -55
  170. data/lib/voruby/stc/region_v1_20.rb +0 -274
  171. data/lib/voruby/stc/stc_v1_20.rb +0 -1196
  172. data/lib/voruby/util.rb +0 -27
  173. data/lib/voruby/voevent/loader.rb +0 -7
  174. data/lib/voruby/voevent/voevent_v1_0.rb +0 -213
  175. data/lib/voruby/voevent/voevent_v1_1.rb +0 -196
  176. data/lib/voruby/votables/chandra.rb +0 -373
  177. data/lib/voruby/votables/data.rb +0 -179
  178. data/lib/voruby/votables/galex.rb +0 -377
  179. data/lib/voruby/votables/int.rb +0 -354
  180. data/lib/voruby/votables/libxml_parser.rb +0 -411
  181. data/lib/voruby/votables/libxml_votable.rb +0 -67
  182. data/lib/voruby/votables/loader.rb +0 -10
  183. data/lib/voruby/votables/meta.rb +0 -763
  184. data/lib/voruby/votables/misc.rb +0 -51
  185. data/lib/voruby/votables/nsa.rb +0 -410
  186. data/lib/voruby/votables/rexml_parser.rb +0 -408
  187. data/lib/voruby/votables/rexml_votable.rb +0 -67
  188. data/lib/voruby/votables/sdss.rb +0 -356
  189. data/lib/voruby/votables/transforms.rb +0 -388
  190. data/lib/voruby/votables/tree.rb +0 -45
  191. data/lib/voruby/votables/types.rb +0 -391
  192. data/lib/voruby/votables/votable.rb +0 -687
  193. data/test/active_votable/database.yml +0 -6
  194. data/test/active_votable/test.vot +0 -168492
  195. data/test/active_votable/unittest.rb +0 -41
  196. data/test/adql/test1.adql +0 -49
  197. data/test/adql/test2.adql +0 -51
  198. data/test/adql/test3.adql +0 -81
  199. data/test/adql/test4.adql +0 -53
  200. data/test/adql/test5.adql +0 -55
  201. data/test/adql/test6.adql +0 -18
  202. data/test/adql/test7.adql +0 -48
  203. data/test/adql/unittest.rb +0 -1672
  204. data/test/plastic/test.rb +0 -44
  205. data/test/plastic/test.vot +0 -5385
  206. data/test/plastic/unittest.rb +0 -66
  207. data/test/resources/conesearch/conesearch_v0_3.xml +0 -31
  208. data/test/resources/conesearch/conesearch_v1_0.xml +0 -86
  209. data/test/resources/conesearch/unittest_v0_3.rb +0 -22
  210. data/test/resources/conesearch/unittest_v1_0.rb +0 -24
  211. data/test/resources/openskynode/open_sky_node_v0_1.xml +0 -32
  212. data/test/resources/openskynode/unittest_v0_1.rb +0 -31
  213. data/test/resources/sia/simple_image_access_v0_7.xml +0 -36
  214. data/test/resources/sia/simple_image_access_v1_0.xml +0 -122
  215. data/test/resources/sia/unittest_v0_7.rb +0 -24
  216. data/test/resources/sia/unittest_v1_0.rb +0 -29
  217. data/test/resources/stsci.xml +0 -336
  218. data/test/resources/unittest_stsci.rb +0 -25
  219. data/test/resources/vodataservice/catalog_service_resource_v1_0.xml +0 -128
  220. data/test/resources/vodataservice/data_collection_resource_v0_5.xml +0 -54
  221. data/test/resources/vodataservice/data_collection_resource_v1_0.xml +0 -117
  222. data/test/resources/vodataservice/data_service_resource_v1_0.xml +0 -115
  223. data/test/resources/vodataservice/sky_service_resource_v0_10.xml +0 -45
  224. data/test/resources/vodataservice/table_service_resource_v1_0.xml +0 -122
  225. data/test/resources/vodataservice/tabular_sky_service_resource_v0_10.xml +0 -60
  226. data/test/resources/vodataservice/unittest_v0_5.rb +0 -126
  227. data/test/resources/vodataservice/unittest_v1_0.rb +0 -151
  228. data/test/resources/voregistry/authority_resource_v0_3.xml +0 -20
  229. data/test/resources/voregistry/authority_resource_v1_0.xml +0 -82
  230. data/test/resources/voregistry/registry_service_v0_3.xml +0 -20
  231. data/test/resources/voregistry/registry_service_v1_0.xml +0 -107
  232. data/test/resources/voregistry/unittest_v0_3.rb +0 -31
  233. data/test/resources/voregistry/unittest_v1_0.rb +0 -34
  234. data/test/resources/voresource/organisation_resource_v1_0.xml +0 -90
  235. data/test/resources/voresource/resource_organisation_v0_10.xml +0 -22
  236. data/test/resources/voresource/resource_service_v0_10.xml +0 -19
  237. data/test/resources/voresource/resource_v0_10.xml +0 -19
  238. data/test/resources/voresource/resource_v1_0.xml +0 -79
  239. data/test/resources/voresource/service_resource_v1_0.xml +0 -91
  240. data/test/resources/voresource/unittest_v0_10.rb +0 -61
  241. data/test/resources/voresource/unittest_v0_9.rb +0 -4
  242. data/test/resources/voresource/unittest_v1_0.rb +0 -190
  243. data/test/services/gestalt/unittest.rb +0 -74
  244. data/test/services/registry/unittest.rb +0 -34
  245. data/test/services/resolver/unittest.rb +0 -38
  246. data/test/simple/unittest.rb +0 -46
  247. data/test/spacetime/unittest.rb +0 -39
  248. data/test/stc/catalog_entry_location_v1_20.xml +0 -112
  249. data/test/stc/obs_data_location_v1_20.xml +0 -108
  250. data/test/stc/search_location_v1_20.xml +0 -54
  251. data/test/stc/stc_resource_profile_v1_20.xml +0 -60
  252. data/test/stc/unittest_v1_20.rb +0 -620
  253. data/test/voevent/unittest_v1_0.rb +0 -79
  254. data/test/voevent/unittest_v1_1.rb +0 -70
  255. data/test/voevent/voevent_v1_0.xml +0 -96
  256. data/test/votables/test.vot +0 -366
  257. data/test/votables/unittest.rb +0 -54
@@ -1,39 +0,0 @@
1
- require 'test/unit'
2
- require 'voruby/spacetime/spacetime'
3
-
4
- include VORuby::CoordinateSystems
5
-
6
- class EquatorialPositionTest < Test::Unit::TestCase
7
- def setup
8
- @menkalinan = Equatorial::RADecPosition.new('5:59:31.67', '44:56:50.8')
9
- @capella = Equatorial::RADecPosition.new('5:16:41.43', '45:59:50.0')
10
- @vega = Equatorial::RADecPosition.new('18:36:56.48', '38:47:03.1')
11
- @arcturus = Equatorial::RADecPosition.new('14:15:39.14', '19:10:43.8')
12
- @antares = Equatorial::RADecPosition.new('16:29:24.45', '-26:25:55.4')
13
-
14
- @rlyr = Equatorial::RADecPosition.new(283.45, 43.883, nil, 1950.0, :fk4)
15
- @pole = Equatorial::RADecPosition.new('02:31:46.3', '89:15:50.6')
16
- @epsind = Equatorial::RADecPosition.new('21:59:33.053', '-56:59:33.053', nil, 1950.0, :fk4)
17
- end
18
-
19
- def test_to_s
20
- assert_equal(@menkalinan.to_s, '05:59:31.67, +44:56:50.80')
21
- assert_equal(@capella.to_s, '05:16:41.43, +45:59:50.00')
22
- assert_equal(@vega.to_s, '18:36:56.48, +38:47:3.10')
23
- assert_equal(@arcturus.to_s, '14:15:39.14, +19:10:43.80')
24
- assert_equal(@antares.to_s, '16:29:24.45, -26:25:55.40')
25
- end
26
-
27
- def test_angular_sep
28
- assert_equal(sprintf("%.2f", @menkalinan.angular_separation(@capella)), '7.58')
29
- assert_equal(sprintf("%.2f", @menkalinan.angular_separation(@vega)), '95.85')
30
- assert_equal(sprintf("%.2f", @capella.angular_separation(@vega)), '93.33')
31
- assert_equal(sprintf("%.2f", @arcturus.angular_separation(@antares)), '55.98')
32
- end
33
-
34
- def test_precess
35
- assert_equal(@rlyr.precess(2000.0).to_s, '18:55:19.21, +43:56:55.15')
36
- assert_equal(@pole.precess(1985.0).to_s, '02:16:22.73, +89:11:47.30')
37
- assert_equal(@epsind.precess(1975.0, :fk4).to_s, '22:01:15.46, -56:52:18.70')
38
- end
39
- end
@@ -1,112 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <CatalogEntryLocation xmlns="http://www.ivoa.net/xml/STC/stc-v1.20.xsd" xmlns:crd="http://www.ivoa.net/xml/STC/STCcoords/v1.20" xmlns:reg="http://www.ivoa.net/xml/STC/STCregion/v1.20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ivoa.net/xml/STC/stc-v1.20.xsd stc-v1.20.xsd">
3
- <AstroCoordSystem ID="B1950-OPTICAL-ET">
4
- <TimeFrame>
5
- <Name>Time</Name>
6
- <TimeScale>ET</TimeScale>
7
- <TOPOCENTER/>
8
- </TimeFrame>
9
- <SpaceFrame>
10
- <Name>PosEq</Name>
11
- <FK4>
12
- <Equinox>B1950.0</Equinox>
13
- </FK4>
14
- <BARYCENTER/>
15
- <SPHERICAL coord_naxes="2" coord_vel="true"/>
16
- </SpaceFrame>
17
- <SpectralFrame>
18
- <Name>Optical</Name>
19
- <TOPOCENTER/>
20
- </SpectralFrame>
21
- <RedshiftFrame>
22
- <Name>DopplerVelocity</Name>
23
- <DopplerDefinition>OPTICAL</DopplerDefinition>
24
- <BARYCENTER/>
25
- </RedshiftFrame>
26
- </AstroCoordSystem>
27
- <AstroCoordSystem ID="SGC-OPTICAL-ET">
28
- <TimeFrame>
29
- <Name>Time</Name>
30
- <TimeScale>ET</TimeScale>
31
- <TOPOCENTER/>
32
- </TimeFrame>
33
- <SpaceFrame>
34
- <Name>SGC</Name>
35
- <SUPER_GALACTIC/>
36
- <BARYCENTER/>
37
- <SPHERICAL coord_naxes="2" coord_vel="true"/>
38
- </SpaceFrame>
39
- <SpectralFrame>
40
- <Name>Optical</Name>
41
- <TOPOCENTER/>
42
- </SpectralFrame>
43
- <RedshiftFrame>
44
- <Name>DopplerVelocity</Name>
45
- <DopplerDefinition>OPTICAL</DopplerDefinition>
46
- <GALACTIC_CENTER/>
47
- </RedshiftFrame>
48
- </AstroCoordSystem>
49
- <crd:AstroCoords coord_system_id="B1950-OPTICAL-ET">
50
- <crd:Position2D unit="deg">
51
- <crd:Name>RA,Dec</crd:Name>
52
- <crd:Value2Ref>Column3</crd:Value2Ref>
53
- <crd:Error2Ref>Column4</crd:Error2Ref>
54
- <crd:Size2Ref>Column5</crd:Size2Ref>
55
- </crd:Position2D>
56
- <crd:Redshift unit="km" vel_time_unit="s">
57
- <crd:Name>Vrad(barycenter)</crd:Name>
58
- <crd:ValueRef>Column6</crd:ValueRef>
59
- <crd:ErrorRef>Column7</crd:ErrorRef>
60
- </crd:Redshift>
61
- </crd:AstroCoords>
62
- <crd:AstroCoords coord_system_id="SGC-OPTICAL-ET">
63
- <crd:Position2D unit="deg">
64
- <crd:Name>SGLong,SGLat</crd:Name>
65
- <crd:Value2Ref>Column8</crd:Value2Ref>
66
- <crd:Error2Ref>Column9</crd:Error2Ref>
67
- <crd:Size2Ref>Column10</crd:Size2Ref>
68
- </crd:Position2D>
69
- <crd:Redshift unit="km" vel_time_unit="s">
70
- <crd:Name>Vrad(Galcenter)</crd:Name>
71
- <crd:ValueRef>Column11</crd:ValueRef>
72
- <crd:ErrorRef>Column12</crd:ErrorRef>
73
- </crd:Redshift>
74
- </crd:AstroCoords>
75
- <AstroCoordArea coord_system_id="B1950-OPTICAL-ET" ID="RA6-18hDec20-70deg">
76
- <TimeInterval>
77
- <StartTime>
78
- <crd:Timescale>ET</crd:Timescale>
79
- <crd:JDTime>2440000</crd:JDTime>
80
- </StartTime>
81
- <EndTime>
82
- <crd:Timescale>ET</crd:Timescale>
83
- <crd:JDTime>2441000</crd:JDTime>
84
- </EndTime>
85
- </TimeInterval>
86
- <Region>
87
- <reg:Polygon unit="deg">
88
- <reg:Vertex>
89
- <reg:Position>270 20</reg:Position>
90
- </reg:Vertex>
91
- <reg:Vertex>
92
- <reg:Position>90 20</reg:Position>
93
- <reg:SmallCircle/>
94
- </reg:Vertex>
95
- <reg:Vertex>
96
- <reg:Position>90 70</reg:Position>
97
- </reg:Vertex>
98
- <reg:Vertex>
99
- <reg:Position>270 70</reg:Position>
100
- <reg:SmallCircle/>
101
- </reg:Vertex>
102
- </reg:Polygon>
103
- </Region>
104
- <SpectralInterval unit="Angstrom">
105
- <LoLimit>5000</LoLimit>
106
- <HiLimit>6500</HiLimit>
107
- </SpectralInterval>
108
- <RedshiftInterval unit="km" vel_time_unit="s">
109
- <HiLimit>10000</HiLimit>
110
- </RedshiftInterval>
111
- </AstroCoordArea>
112
- </CatalogEntryLocation>
@@ -1,108 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <ObsDataLocation xmlns="http://www.ivoa.net/xml/STC/stc-v1.20.xsd" xmlns:crd="http://www.ivoa.net/xml/STC/STCcoords/v1.20" xmlns:reg="http://www.ivoa.net/xml/STC/STCregion/v1.20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ivoa.net/xml/STC/stc-v1.20.xsd stc-v1.20.xsd">
3
- <ObservatoryLocation ID="KPNO">
4
- <AstroCoordSystem ID="ICRS-TT-TOPO">
5
- <TimeFrame>
6
- <Name>Time</Name>
7
- <TimeScale>TT</TimeScale>
8
- <TOPOCENTER/>
9
- </TimeFrame>
10
- <SpaceFrame>
11
- <Name>GeoLongLatElev</Name>
12
- <GEO_D/>
13
- <TOPOCENTER/>
14
- <SPHERICAL coord_naxes="3"/>
15
- </SpaceFrame>
16
- </AstroCoordSystem>
17
- <crd:AstroCoords coord_system_id="KPNO">
18
- <crd:Position3D unit="deg deg m">
19
- <crd:Name>LongLatElev</crd:Name>
20
- <crd:Value3>248.4056 31.9586 2158</crd:Value3>
21
- </crd:Position3D>
22
- </crd:AstroCoords>
23
- </ObservatoryLocation>
24
- <ObservationLocation ID="M81">
25
- <AstroCoordSystem ID="ICRS-TT-WAVELENGTH-TOPO">
26
- <TimeFrame>
27
- <Name>Time</Name>
28
- <TimeScale>TT</TimeScale>
29
- <TOPOCENTER/>
30
- </TimeFrame>
31
- <SpaceFrame>
32
- <Name>Equatorial</Name>
33
- <ICRS/>
34
- <TOPOCENTER/>
35
- <SPHERICAL coord_naxes="2"/>
36
- </SpaceFrame>
37
- <SpectralFrame>
38
- <Name>Wavelength</Name>
39
- <TOPOCENTER/>
40
- </SpectralFrame>
41
- </AstroCoordSystem>
42
- <crd:AstroCoords coord_system_id="ICRS-TT-WAVELENGTH-TOPO">
43
- <crd:Time unit="s">
44
- <crd:Name>Time</crd:Name>
45
- <crd:TimeInstant>
46
- <crd:Timescale>TT</crd:Timescale>
47
- <crd:ISOTime>2004-07-15T08:23:56</crd:ISOTime>
48
- </crd:TimeInstant>
49
- <crd:PixSize>1000</crd:PixSize>
50
- </crd:Time>
51
- <crd:Position2D unit="deg">
52
- <crd:Name>RA,Dec</crd:Name>
53
- <crd:Value2>148.88821 69.06529</crd:Value2>
54
- <crd:Error2>0.0003 0.0003</crd:Error2>
55
- <crd:Resolution2>0.00025 0.00025</crd:Resolution2>
56
- <crd:PixSize2>0.0001 0.0001</crd:PixSize2>
57
- </crd:Position2D>
58
- <crd:Spectral unit="Angstrom">
59
- <crd:Name>Lambda</crd:Name>
60
- <crd:Value>4600</crd:Value>
61
- <crd:Resolution>400</crd:Resolution>
62
- <crd:PixSize>400</crd:PixSize>
63
- </crd:Spectral>
64
- </crd:AstroCoords>
65
- <AstroCoordArea ID="M81Image" coord_system_id="ICRS-TT-WAVELENGTH-TOPO">
66
- <TimeInterval>
67
- <StartTime>
68
- <crd:Timescale>TT</crd:Timescale>
69
- <crd:ISOTime>2004-07-15T08:17:36</crd:ISOTime>
70
- </StartTime>
71
- <StopTime>
72
- <crd:Timescale>TT</crd:Timescale>
73
- <crd:ISOTime>2004-07-15T08:30:16</crd:ISOTime>
74
- </StopTime>
75
- </TimeInterval>
76
- <PositionInterval unit="deg">
77
- <Coord2VecInterval>
78
- <LoLimit2Vec>148.18821 68.81529</LoLimit2Vec>
79
- <HiLimit2Vec>149.58821 69.31529</HiLimit2Vec>
80
- </Coord2VecInterval>
81
- </PositionInterval>
82
- <SpectralInterval unit="Angstrom">
83
- <LoLimit>4400</LoLimit>
84
- <HiLimit>4800</HiLimit>
85
- </SpectralInterval>
86
- </AstroCoordArea>
87
- </ObservationLocation>
88
- <PixelSpace>
89
- <PixelCoordSystem ID="M81Pix">
90
- <PixelCoordFrame>
91
- <Name>X</Name>
92
- </PixelCoordFrame>
93
- <PixelCoordFrame>
94
- <Name>Y</Name>
95
- </PixelCoordFrame>
96
- </PixelCoordSystem>
97
- <PixelCoordArea coord_system_id="M81Pix" ID="M81PixImage">
98
- <CoordScalarInterval>
99
- <LoLimit>1</LoLimit>
100
- <HiLimit>1024</HiLimit>
101
- </CoordScalarInterval>
102
- <CoordScalarInterval>
103
- <LoLimit>1</LoLimit>
104
- <HiLimit>1024</HiLimit>
105
- </CoordScalarInterval>
106
- </PixelCoordArea>
107
- </PixelSpace>
108
- </ObsDataLocation>
@@ -1,54 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <SearchLocation xmlns="http://www.ivoa.net/xml/STC/stc-v1.20.xsd" xmlns:crd="http://www.ivoa.net/xml/STC/STCcoords/v1.20" xmlns:reg="http://www.ivoa.net/xml/STC/STCregion/v1.20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ivoa.net/xml/STC/stc-v1.20.xsd stc-v1.20.xsd">
3
- <AstroCoordSystem ID="ICRS-TT-BARY">
4
- <TimeFrame>
5
- <Name>Time</Name>
6
- <TimeScale>TT</TimeScale>
7
- <BARYCENTER/>
8
- </TimeFrame>
9
- <SpaceFrame>
10
- <Name>Equatorial</Name>
11
- <ICRS/>
12
- <BARYCENTER/>
13
- <SPHERICAL coord_naxes="2"/>
14
- </SpaceFrame>
15
- <SpectralFrame>
16
- <Name>Wavelength</Name>
17
- <BARYCENTER/>
18
- </SpectralFrame>
19
- </AstroCoordSystem>
20
- <crd:AstroCoords coord_system_id="ICRS-TT-BARY">
21
- <crd:Position2D unit="deg">
22
- <crd:Name>RA,Dec</crd:Name>
23
- <crd:Resolution2>0.0001 0.0001</crd:Resolution2>
24
- <crd:Resolution2>0.0003 0.0003</crd:Resolution2>
25
- <crd:Size2>0.5 0.5</crd:Size2>
26
- <crd:Size2>0.67 0.67</crd:Size2>
27
- <crd:PixSize2>0.00005 0.00005</crd:PixSize2>
28
- <crd:PixSize2>0.00015 0.00015</crd:PixSize2>
29
- </crd:Position2D>
30
- <crd:Spectral unit="Angstrom">
31
- <crd:Name>Lambda</crd:Name>
32
- <crd:Resolution>300</crd:Resolution>
33
- <crd:Resolution>600</crd:Resolution>
34
- </crd:Spectral>
35
- </crd:AstroCoords>
36
- <AstroCoordArea ID="M81" coord_system_id="ICRS-TT-BARY">
37
- <TimeInterval>
38
- <StartTime>
39
- <crd:Timescale>TT</crd:Timescale>
40
- <crd:ISOTime>1900-01-01T00:00:00</crd:ISOTime>
41
- </StartTime>
42
- </TimeInterval>
43
- <Region>
44
- <reg:Circle unit="deg">
45
- <reg:Center>148.9 69.1</reg:Center>
46
- <reg:Radius>2</reg:Radius>
47
- </reg:Circle>
48
- </Region>
49
- <SpectralInterval unit="Angstrom">
50
- <LoLimit>4000</LoLimit>
51
- <HiLimit>7000</HiLimit>
52
- </SpectralInterval>
53
- </AstroCoordArea>
54
- </SearchLocation>
@@ -1,60 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <STCResourceProfile xmlns="http://www.ivoa.net/xml/STC/stc-v1.20.xsd" xmlns:crd="http://www.ivoa.net/xml/STC/STCcoords/v1.20" xmlns:reg="http://www.ivoa.net/xml/STC/STCregion/v1.20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ivoa.net/xml/STC/stc-v1.20.xsd stc-v1.20.xsd">
3
- <AstroCoordSystem ID="ICRS-TT-CXO">
4
- <TimeFrame>
5
- <Name>Time</Name>
6
- <TimeScale>TT</TimeScale>
7
- <TOPOCENTER/>
8
- </TimeFrame>
9
- <SpaceFrame>
10
- <Name>Space</Name>
11
- <ICRS/>
12
- <TOPOCENTER/>
13
- <SPHERICAL coord_naxes="2"/>
14
- </SpaceFrame>
15
- <SpectralFrame>
16
- <Name>Energy</Name>
17
- <TOPOCENTER/>
18
- </SpectralFrame>
19
- </AstroCoordSystem>
20
- <crd:AstroCoords coord_system_id="ICRS-TT-CXO">
21
- <crd:Time unit="s">
22
- <crd:Name>Time</crd:Name>
23
- <crd:Error>0.0001</crd:Error>
24
- <crd:Resolution>0.000016</crd:Resolution>
25
- <crd:Resolution>3.0</crd:Resolution>
26
- <crd:Size>1000</crd:Size>
27
- <crd:Size>170000</crd:Size>
28
- </crd:Time>
29
- <crd:Position2D unit="arcsec">
30
- <crd:Name>Position</crd:Name>
31
- <crd:Error2>1.0 1.0</crd:Error2>
32
- <crd:Resolution2>0.5 0.5</crd:Resolution2>
33
- <crd:Size2>1000 1000</crd:Size2>
34
- <crd:Size2>4000 4000</crd:Size2>
35
- </crd:Position2D>
36
- <crd:Spectral unit="keV">
37
- <crd:Name>Energy</crd:Name>
38
- <crd:Error>0.1</crd:Error>
39
- <crd:Resolution>0.02</crd:Resolution>
40
- <crd:Resolution>2.0</crd:Resolution>
41
- <crd:Size>2</crd:Size>
42
- <crd:Size>10</crd:Size>
43
- </crd:Spectral>
44
- </crd:AstroCoords>
45
- <AstroCoordArea ID="AllSky-CXO" coord_system_id="ICRS-TT-CXO">
46
- <TimeInterval>
47
- <StartTime>
48
- <crd:Timescale>TT</crd:Timescale>
49
- <crd:ISOTime>1999-07-23T16:00:00</crd:ISOTime>
50
- </StartTime>
51
- </TimeInterval>
52
- <Region>
53
- <reg:AllSky fill_factor="0.02"/>
54
- </Region>
55
- <SpectralInterval unit="keV">
56
- <LoLimit>0.12</LoLimit>
57
- <HiLimit>10.0</HiLimit>
58
- </SpectralInterval>
59
- </AstroCoordArea>
60
- </STCResourceProfile>
@@ -1,620 +0,0 @@
1
- require 'test/unit'
2
-
3
- require 'voruby/stc/stc_v1_20'
4
-
5
- include VORuby::STC::V1_20
6
-
7
- class STCTest < Test::Unit::TestCase
8
- def test_space_frame
9
- frame = nil
10
- assert_nothing_raised {
11
- frame = SpaceFrame.load_from_xml(
12
- REXML::Document.new(
13
- '<SpaceFrame>' +
14
- '<Name>GeoLongLatElev</Name>' +
15
- '<GEO_D/>' +
16
- '<TOPOCENTER/>' +
17
- '<SPHERICAL coord_naxes="3"/>' +
18
- '<OffsetCenter><Value>23.2</Value></OffsetCenter>' +
19
- '</SpaceFrame>').root
20
- )
21
- }
22
-
23
- assert_equal('GeoLongLatElev', frame.value.name)
24
- assert_equal(true, frame.value.space_ref_frame.is_a?(GEO_D))
25
- assert_equal(true, frame.value.reference_position.is_a?(TOPOCENTER))
26
- assert_equal(true, frame.value.coord_flavor.is_a?(SPHERICAL))
27
- assert_equal(3, frame.value.coord_flavor.value.coord_naxes)
28
- assert_equal(23.2, frame.value.offset_center.value)
29
- end
30
-
31
- def test_time_frame
32
- frame = nil
33
- assert_nothing_raised {
34
- frame = TimeFrame.load_from_xml(
35
- REXML::Document.new(
36
- '<TimeFrame>' +
37
- '<Name>CrazyTime</Name>' +
38
- '<TimeScale>LOCAL</TimeScale>' +
39
- '<HELIOCENTER />' +
40
- '</TimeFrame>').root
41
- )
42
- }
43
-
44
- assert_equal('CrazyTime', frame.value.name)
45
- assert_equal('LOCAL', frame.value.time_scale.value)
46
- assert_equal(true, frame.value.reference_position.is_a?(HELIOCENTER))
47
- end
48
-
49
- def test_astro_coord_area
50
- area = nil
51
- assert_nothing_raised {
52
- area = AstroCoordArea.load_from_xml(
53
- REXML::Document.new(
54
- '<AstroCoordArea ID="myID" coord_system_id="myCoordSystem">' +
55
- '<Sphere unit="deg" radius_unit="deg">' +
56
- '<Radius>23</Radius>' +
57
- '<Center>0 0 0</Center>' +
58
- '</Sphere>' +
59
- '<VelocityInterval unit="m" vel_time_unit="s">' +
60
- '<CoordScalarInterval>' +
61
- '<LoLimit>0</LoLimit>' +
62
- '<HiLimit>10</HiLimit>' +
63
- '</CoordScalarInterval>' +
64
- '</VelocityInterval>' +
65
- '<CoordScalarInterval>' +
66
- '<LoLimit>0</LoLimit>' +
67
- '<HiLimit>10</HiLimit>' +
68
- '</CoordScalarInterval>' +
69
- '<CoordScalarInterval>' +
70
- '<LoLimit>10</LoLimit>' +
71
- '<HiLimit>50</HiLimit>' +
72
- '</CoordScalarInterval>' +
73
- '</AstroCoordArea>').root
74
- )
75
- }
76
-
77
- assert_equal('myID', area.value.coord_area_id)
78
- assert_equal('myCoordSystem', area.value.coord_system_id)
79
-
80
- assert_equal('deg', area.value.spatial_interval.value.unit.value)
81
- assert_equal('deg', area.value.spatial_interval.value.radius_unit.value)
82
- assert_equal(23, area.value.spatial_interval.value.radius)
83
- assert_equal([0, 0, 0], area.value.spatial_interval.value.center.value)
84
-
85
- assert_equal(0, area.value.coord_intervals[0].value.lo_limit)
86
- assert_equal(10, area.value.coord_intervals[0].value.hi_limit)
87
- assert_equal(10, area.value.coord_intervals[1].value.lo_limit)
88
- assert_equal(50, area.value.coord_intervals[1].value.hi_limit)
89
-
90
- assert_equal('m', area.value.vel_intervals[0].value.unit.value)
91
- assert_equal('s', area.value.vel_intervals[0].value.vel_time_unit.value)
92
- assert_equal(10, area.value.vel_intervals[0].value.coord_interval.value.hi_limit)
93
- end
94
-
95
- def test_stc_resoure_profile
96
- profile = nil
97
- assert_nothing_raised {
98
- profile = STCResourceProfile.load_from_file('test/stc/stc_resource_profile_v1_20.xml')
99
- }
100
-
101
- coord_sys = profile.value.coord_sys[0].value
102
- assert_equal('ICRS-TT-CXO', coord_sys.coord_sys_type_id)
103
- assert_equal('Time', coord_sys.time_frame.value.name)
104
- assert_equal('TT', coord_sys.time_frame.value.time_scale.value)
105
- assert_equal(TOPOCENTER, coord_sys.time_frame.value.reference_position.class)
106
- assert_equal('Space', coord_sys.space_frame.value.name)
107
- assert_equal(ICRS, coord_sys.space_frame.value.space_ref_frame.class)
108
- assert_equal(TOPOCENTER, coord_sys.space_frame.value.reference_position.class)
109
- assert_equal(SPHERICAL, coord_sys.space_frame.value.coord_flavor.class)
110
- assert_equal(2, coord_sys.space_frame.value.coord_flavor.value.coord_naxes)
111
- assert_equal('Energy', coord_sys.spectral_frame.value.name)
112
- assert_equal(TOPOCENTER, coord_sys.spectral_frame.value.reference_position.class)
113
-
114
- coords = profile.value.coords[0].value
115
- assert_equal('ICRS-TT-CXO', coords.coord_system_id)
116
- assert_equal('s', coords.time.unit.value)
117
- assert_equal('Time', coords.time.name)
118
- assert_equal(0.0001, coords.time.error[0].value)
119
- assert_equal([0.000016, 3.0], coords.time.resolution.collect{ |res| res.value })
120
- assert_equal([1000, 170000], coords.time.size.collect{ |size| size.value })
121
- assert_equal('Position', coords.position.name)
122
- assert_equal([1.0, 1.0], coords.position.error[0].value.value)
123
- assert_equal([0.5, 0.5], coords.position.resolution[0].value.value)
124
- assert_equal([1000, 1000], coords.position.size[0].value.value)
125
- assert_equal([4000, 4000], coords.position.size[1].value.value)
126
- assert_equal('keV', coords.spectral.unit.value)
127
- assert_equal('Energy', coords.spectral.name)
128
- assert_equal(0.1, coords.spectral.error[0].value)
129
- assert_equal(0.02, coords.spectral.resolution[0].value)
130
- assert_equal(2.0, coords.spectral.resolution[1].value)
131
- assert_equal(2, coords.spectral.size[0].value)
132
- assert_equal(10, coords.spectral.size[1].value)
133
-
134
- coord_area = profile.value.coord_area[0].value
135
- assert_equal('AllSky-CXO', coord_area.coord_area_id)
136
- assert_equal('ICRS-TT-CXO', coord_area.coord_system_id)
137
- assert_equal('TT', coord_area.time_intervals[0].start_time.timescale.value)
138
- assert_equal('1999-07-23T16:00:00', coord_area.time_intervals[0].start_time.absolute_time.value.strftime('%Y-%m-%dT%H:%M:%S'))
139
- assert_equal(true, coord_area.spatial_interval.value.region.is_a?(AllSky))
140
- assert_equal(0.02, coord_area.spatial_interval.value.region.value.fill_factor)
141
- assert_equal('keV', coord_area.spectral_intervals[0].unit.value)
142
- assert_equal(0.12, coord_area.spectral_intervals[0].lo_limit)
143
- assert_equal(10.0, coord_area.spectral_intervals[0].hi_limit)
144
- end
145
-
146
- def test_catalog_entry_location
147
- catalog = nil
148
- assert_nothing_raised {
149
- catalog = CatalogEntryLocation.load_from_file('test/stc/catalog_entry_location_v1_20.xml')
150
- }
151
-
152
- coord_sys1 = catalog.value.coord_sys[0].value
153
- assert_equal('B1950-OPTICAL-ET', coord_sys1.coord_sys_type_id)
154
- assert_equal('Time', coord_sys1.time_frame.value.name)
155
- assert_equal('ET', coord_sys1.time_frame.value.time_scale.value)
156
- assert_equal(true, coord_sys1.time_frame.value.reference_position.is_a?(TOPOCENTER))
157
- assert_equal('PosEq', coord_sys1.space_frame.value.name)
158
- assert_equal('B1950.0', coord_sys1.space_frame.value.space_ref_frame.value.equinox.value)
159
- assert_equal(true, coord_sys1.space_frame.value.reference_position.is_a?(BARYCENTER))
160
- assert_equal(true, coord_sys1.space_frame.value.coord_flavor.is_a?(SPHERICAL))
161
- assert_equal(2, coord_sys1.space_frame.value.coord_flavor.value.coord_naxes)
162
- assert_equal(true, coord_sys1.space_frame.value.coord_flavor.value.coord_vel)
163
- assert_equal('Optical', coord_sys1.spectral_frame.value.name)
164
- assert_equal(true, coord_sys1.spectral_frame.value.reference_position.is_a?(TOPOCENTER))
165
- assert_equal('DopplerVelocity', coord_sys1.redshift_frame.value.name)
166
- assert_equal('OPTICAL', coord_sys1.redshift_frame.value.doppler_definition.value)
167
- assert_equal(true, coord_sys1.redshift_frame.value.reference_position.is_a?(BARYCENTER))
168
-
169
- coord1 = catalog.value.coords[0].value
170
- assert_equal('B1950-OPTICAL-ET', coord1.coord_system_id)
171
- assert_equal('deg', coord1.position.unit.value)
172
- assert_equal('RA,Dec', coord1.position.name)
173
- assert_equal('Column3', coord1.position.value.value)
174
- assert_equal('Column4', coord1.position.error[0].value)
175
- assert_equal('Column5', coord1.position.size[0].value)
176
- assert_equal('km', coord1.redshift.unit.value)
177
- assert_equal('s', coord1.redshift.vel_time_unit.value)
178
- assert_equal('Vrad(barycenter)', coord1.redshift.name)
179
- assert_equal('Column6', coord1.redshift.value.value)
180
- assert_equal('Column7', coord1.redshift.error[0].value)
181
-
182
- coord_area1 = catalog.value.coord_area[0].value
183
- assert_equal('B1950-OPTICAL-ET', coord_area1.coord_system_id)
184
- assert_equal('RA6-18hDec20-70deg', coord_area1.coord_area_id)
185
- assert_equal('ET', coord_area1.time_intervals[0].start_time.timescale.value)
186
- assert_match('1968-05-23T00:00:00', coord_area1.time_intervals[0].start_time.absolute_time.value.to_s)
187
- assert_equal('ET', coord_area1.time_intervals[0].end_time.timescale.value)
188
- assert_match('1971-02-17T00:00:00', coord_area1.time_intervals[0].end_time.absolute_time.value.to_s)
189
- assert_equal(true, coord_area1.spatial_interval.value.region.is_a?(Polygon))
190
- assert_equal('deg', coord_area1.spatial_interval.value.region.value.unit.value)
191
- assert_equal([270, 70], coord_area1.spatial_interval.value.region.value.vertices[3].position.value)
192
- assert_equal(true, coord_area1.spatial_interval.value.region.value.vertices[3].small_circle.is_a?(SmallCircleType))
193
- assert_equal('Angstrom', coord_area1.spectral_intervals[0].unit.value)
194
- assert_equal(5000, coord_area1.spectral_intervals[0].lo_limit)
195
- assert_equal(6500, coord_area1.spectral_intervals[0].hi_limit)
196
- assert_equal('km', coord_area1.redshift_intervals[0].unit.value)
197
- assert_equal('s', coord_area1.redshift_intervals[0].vel_time_unit.value)
198
- assert_equal(10000, coord_area1.redshift_intervals[0].hi_limit)
199
- end
200
-
201
- def test_obs_data_location
202
- obs_data = nil
203
- assert_nothing_raised {
204
- obs_data = ObsDataLocation.load_from_file('test/stc/obs_data_location_v1_20.xml')
205
- }
206
-
207
- observ_loc = obs_data.value.observatory_location
208
- assert_equal('KPNO', observ_loc.type_id)
209
- assert_equal('ICRS-TT-TOPO', observ_loc.coord_sys[0].value.coord_sys_type_id)
210
- assert_equal('Time', observ_loc.coord_sys[0].value.time_frame.value.name)
211
- assert_equal('GeoLongLatElev', observ_loc.coord_sys[0].value.space_frame.value.name)
212
- assert_equal('KPNO', observ_loc.coords.value.coord_system_id)
213
- assert_equal('deg deg m', observ_loc.coords.value.position.unit.value)
214
- assert_equal('LongLatElev', observ_loc.coords.value.position.name)
215
-
216
- obs_loc = obs_data.value.observation_location
217
- assert_equal('M81', obs_loc.type_id)
218
- assert_equal('ICRS-TT-WAVELENGTH-TOPO', obs_loc.coord_sys[0].value.coord_sys_type_id)
219
- assert_equal('TT', obs_loc.coord_sys[0].value.time_frame.value.time_scale.value)
220
- assert_equal(true, obs_loc.coord_sys[0].value.space_frame.value.reference_position.is_a?(TOPOCENTER))
221
- assert_equal('Wavelength', obs_loc.coord_sys[0].value.spectral_frame.value.name)
222
- assert_equal('ICRS-TT-WAVELENGTH-TOPO', obs_loc.coords.value.coord_system_id)
223
- assert_equal('2004-07-15T08:23:56', obs_loc.coords.value.time.time_instant.absolute_time.value.strftime('%Y-%m-%dT%H:%M:%S'))
224
- assert_equal([148.88821, 69.06529], obs_loc.coords.value.position.value.value.value)
225
- assert_equal(400, obs_loc.coords.value.spectral.resolution[0].value)
226
- assert_equal('M81Image', obs_loc.coord_area.value.coord_area_id)
227
- assert_equal('TT', obs_loc.coord_area.value.time_intervals[0].start_time.timescale.value)
228
- assert_equal([148.18821, 68.81529], obs_loc.coord_area.value.spatial_interval.value.coord_interval.value.lo_limit_2vec.value)
229
- assert_equal(4400, obs_loc.coord_area.value.spectral_intervals[0].lo_limit)
230
-
231
- pix_space = obs_data.value.pixel_space
232
- assert_equal('M81Pix', pix_space.coord_sys.value.coord_sys_type_id)
233
- assert_equal('Y', pix_space.coord_sys.value.coord_frames[1].value.name)
234
- assert_equal(1024, pix_space.coord_area.value.coord_intervals[0].value.hi_limit)
235
- end
236
-
237
- def test_search_location
238
- loc = nil
239
- assert_nothing_raised {
240
- loc = SearchLocation.load_from_file('test/stc/search_location_v1_20.xml')
241
- }
242
- end
243
- end
244
-
245
- class RegionTest < Test::Unit::TestCase
246
- def test_circle
247
- region = nil
248
- assert_nothing_raised {
249
- region = Circle.load_from_xml(
250
- REXML::Document.new(
251
- '<Circle unit="deg">' +
252
- '<Center>233.73 23.49</Center>' +
253
- '<Radius>1.0</Radius>' +
254
- '</Circle>').root
255
- )
256
- }
257
-
258
- assert_equal('deg', region.value.unit.value)
259
- assert_equal([233.73, 23.49], region.value.center.value)
260
- assert_equal(1.0, region.value.radius)
261
- end
262
-
263
- def test_all_sky
264
- region = nil
265
- assert_nothing_raised {
266
- region = AllSky.load_from_xml(
267
- REXML::Document.new(
268
- '<AllSky fill_factor="0.3" note="My note" />').root
269
- )
270
- }
271
-
272
- assert_equal(0.3, region.value.fill_factor)
273
- assert_equal('My note', region.value.note)
274
- end
275
-
276
- def test_ellipse
277
- region = nil
278
- assert_nothing_raised {
279
- region = Ellipse.load_from_xml(
280
- REXML::Document.new(
281
- '<Ellipse unit="deg">' +
282
- '<Center>233.73 23.49</Center>' +
283
- '<Radius>1.0</Radius>' +
284
- '<MinorRadius>10</MinorRadius>' +
285
- '<PosAngle reference="X">23.2</PosAngle>' +
286
- '</Ellipse>').root
287
- )
288
- }
289
-
290
- assert_equal('deg', region.value.unit.value)
291
- assert_equal([233.73, 23.49], region.value.center.value)
292
- assert_equal(1.0, region.value.radius)
293
- assert_equal(10, region.value.minor_radius)
294
- assert_equal('X', region.value.pos_angle.reference.value)
295
- assert_equal(23.2, region.value.pos_angle.value)
296
- end
297
-
298
- def test_polygon
299
- region = nil
300
- assert_nothing_raised {
301
- region = Polygon.load_from_xml(
302
- REXML::Document.new(
303
- '<Polygon>' +
304
- '<Vertex><Position>12.3 3.1</Position></Vertex>' +
305
- '<Vertex><Position>13.1 6.2</Position></Vertex>' +
306
- '<Vertex><Position>15.6 11.3</Position></Vertex>' +
307
- '</Polygon>').root
308
- )
309
- }
310
-
311
- assert_equal([12.3, 3.1], region.value.vertices[0].position.value)
312
- assert_equal([13.1, 6.2], region.value.vertices[1].position.value)
313
- assert_equal([15.6, 11.3], region.value.vertices[2].position.value)
314
- end
315
-
316
- def test_box
317
- region = nil
318
- assert_nothing_raised {
319
- region = Box.load_from_xml(
320
- REXML::Document.new(
321
- '<Box>' +
322
- '<Center>56 72</Center>' +
323
- '<Size>10 23</Size>' +
324
- '</Box>').root
325
- )
326
- }
327
-
328
- assert_equal([56, 72], region.value.center.value)
329
- assert_equal([10, 23], region.value.size.value)
330
- end
331
-
332
- def test_sector
333
- region = nil
334
- assert_nothing_raised {
335
- region = Sector.load_from_xml(
336
- REXML::Document.new(
337
- '<Sector>' +
338
- '<Position>12.4 10.2</Position>' +
339
- '<PosAngle1>2.0</PosAngle1>' +
340
- '<PosAngle2>33.1</PosAngle2>' +
341
- '</Sector>').root
342
- )
343
- }
344
-
345
- assert_equal([12.4, 10.2], region.value.position.value)
346
- assert_equal(2.0, region.value.pos_angle1.value)
347
- assert_equal(33.1, region.value.pos_angle2.value)
348
- end
349
-
350
- def test_convex
351
- region = nil
352
- assert_nothing_raised {
353
- region = Convex.load_from_xml(
354
- REXML::Document.new(
355
- '<Convex>' +
356
- '<Constraint><Offset>0.5</Offset><Vector>4 6 8</Vector></Constraint>' +
357
- '<Constraint><Offset>0.1</Offset><Vector>10 12 14</Vector></Constraint>' +
358
- '</Convex>').root
359
- )
360
- }
361
-
362
- assert_equal(0.5, region.value.constraints[0].offset)
363
- assert_equal([4, 6, 8], region.value.constraints[0].vector.value)
364
- assert_equal(0.1, region.value.constraints[1].offset)
365
- assert_equal([10, 12, 14], region.value.constraints[1].vector.value)
366
- end
367
-
368
- def test_convex_hull
369
- region = nil
370
- assert_nothing_raised {
371
- region = ConvexHull.load_from_xml(
372
- REXML::Document.new(
373
- '<ConvexHull>' +
374
- '<Point>1.2 3.4 5.6</Point><Point>6.7 8.9 10.11</Point>' +
375
- '</ConvexHull>').root
376
- )
377
- }
378
-
379
- assert_equal([1.2, 3.4, 5.6], region.value.points[0].value)
380
- assert_equal([6.7, 8.9, 10.11], region.value.points[1].value)
381
- end
382
-
383
- def test_union
384
- region = nil
385
- assert_nothing_raised {
386
- region = Union.load_from_xml(
387
- REXML::Document.new(
388
- '<Union>' +
389
- '<Region>' +
390
- '<Circle unit="deg">' +
391
- '<Center>233.73 23.49</Center>' +
392
- '<Radius>1.0</Radius>' +
393
- '</Circle>' +
394
- '</Region>' +
395
- '<Region>' +
396
- '<Circle unit="deg">' +
397
- '<Center>223.73 53.49</Center>' +
398
- '<Radius>20.0</Radius>' +
399
- '</Circle>' +
400
- '</Region>' +
401
- '</Union>').root
402
- )
403
- }
404
-
405
- assert_equal([233.73, 23.49], region.value.regions[0].center.value)
406
- assert_equal(1.0, region.value.regions[0].radius)
407
- assert_equal([223.73, 53.49], region.value.regions[1].center.value)
408
- assert_equal(20.0, region.value.regions[1].radius)
409
- end
410
-
411
- def test_intersection
412
- region = nil
413
- assert_nothing_raised {
414
- region = Intersection.load_from_xml(
415
- REXML::Document.new(
416
- '<Intersection>' +
417
- '<Region>' +
418
- '<Circle unit="deg">' +
419
- '<Center>233.73 23.49</Center>' +
420
- '<Radius>1.0</Radius>' +
421
- '</Circle>' +
422
- '</Region>' +
423
- '<Region>' +
424
- '<Box>' +
425
- '<Center>56 72</Center>' +
426
- '<Size>10 23</Size>' +
427
- '</Box>' +
428
- '</Region>' +
429
- '</Intersection>').root
430
- )
431
- }
432
-
433
- assert_equal([233.73, 23.49], region.value.regions[0].center.value)
434
- assert_equal(1.0, region.value.regions[0].radius)
435
- assert_equal([56, 72], region.value.regions[1].center.value)
436
- assert_equal([10, 23], region.value.regions[1].size.value)
437
- end
438
-
439
- def test_negation
440
- region = nil
441
- assert_nothing_raised {
442
- region = Negation.load_from_xml(
443
- REXML::Document.new(
444
- '<Negation>' +
445
- '<Region>' +
446
- '<Circle unit="deg">' +
447
- '<Center>233.73 23.49</Center>' +
448
- '<Radius>1.0</Radius>' +
449
- '</Circle>' +
450
- '</Region>' +
451
- '</Negation>').root
452
- )
453
- }
454
-
455
- assert_equal([233.73, 23.49], region.value.region.center.value)
456
- assert_equal(1.0, region.value.region.radius)
457
- end
458
-
459
- end
460
-
461
- class CoordsTest < Test::Unit::TestCase
462
- def test_astron_time_type
463
- type = nil
464
- assert_nothing_raised {
465
- type = AstronTimeType.load_from_xml(
466
- REXML::Document.new(
467
- '<AstronTime>' +
468
- '<Timescale>LOCAL</Timescale>' +
469
- '<TimeOffset unit="s">12.2</TimeOffset>' +
470
- '<ISOTime>2006-09-07T15:32:51</ISOTime>' +
471
- '</AstronTime>').root
472
- )
473
- }
474
-
475
- assert_equal('LOCAL', type.timescale.value)
476
- assert_equal('s', type.relative_time.unit.value)
477
- assert_equal(12.2, type.relative_time.value)
478
- assert_equal('2006-09-07T15:32:51', type.absolute_time.value.strftime('%Y-%m-%dT%H:%M:%S'))
479
- end
480
-
481
- def test_scalar_coordinate_type
482
- type = nil
483
- assert_nothing_raised {
484
- type = ScalarCoordinateType.load_from_xml(
485
- REXML::Document.new(
486
- '<ScalarCoordinate>' +
487
- '<Name>Comment</Name>' +
488
- '<Value>23.2</Value>' +
489
- '<Error>0.1</Error><Error>0.5</Error>' +
490
- '<Resolution>0.5</Resolution><Resolution>0.8</Resolution>' +
491
- '<Size>5</Size><Size>10</Size>' +
492
- '<PixSize>0.3</PixSize><PixSize>0.4</PixSize>' +
493
- '</ScalarCoordinate>').root
494
- )
495
- }
496
-
497
- assert_equal(23.2, type.value.value)
498
- assert_equal(0.1, type.error[0].value)
499
- assert_equal(0.5, type.error[1].value)
500
- assert_equal(0.5, type.resolution[0].value)
501
- assert_equal(0.8, type.resolution[1].value)
502
- assert_equal(5, type.size[0].value)
503
- assert_equal(10, type.size[1].value)
504
- assert_equal(0.3, type.pix_size[0].value)
505
- assert_equal(0.4, type.pix_size[1].value)
506
- end
507
-
508
- def test_time_coordinate_type
509
- type = nil
510
- assert_nothing_raised {
511
- type = TimeCoordinateType.load_from_xml(
512
- REXML::Document.new(
513
- '<Time>' +
514
- '<Name>Blah</Name>' +
515
- '<TimeInstant>' +
516
- '<Timescale>LOCAL</Timescale>' +
517
- '<TimeOffset unit="s">12.2</TimeOffset>' +
518
- '<ISOTime>2006-09-07T15:32:51</ISOTime>' +
519
- '</TimeInstant>' +
520
- '<Error>0.1</Error><Error>0.5</Error>' +
521
- '<Resolution>0.5</Resolution><Resolution>0.8</Resolution>' +
522
- '<Size>5</Size><Size>10</Size>' +
523
- '<PixSize>0.3</PixSize><PixSize>0.4</PixSize>' +
524
- '</Time>').root
525
- )
526
- }
527
-
528
- assert_equal('LOCAL', type.time_instant.timescale.value)
529
- assert_equal('s', type.time_instant.relative_time.unit.value)
530
- assert_equal(12.2, type.time_instant.relative_time.value)
531
- assert_equal('2006-09-07T15:32:51', type.time_instant.absolute_time.value.strftime('%Y-%m-%dT%H:%M:%S'))
532
- assert_equal(0.1, type.error[0].value)
533
- assert_equal(0.5, type.error[1].value)
534
- assert_equal(0.5, type.resolution[0].value)
535
- assert_equal(0.8, type.resolution[1].value)
536
- assert_equal(5, type.size[0].value)
537
- assert_equal(10, type.size[1].value)
538
- assert_equal(0.3, type.pix_size[0].value)
539
- assert_equal(0.4, type.pix_size[1].value)
540
- end
541
-
542
- def test_size2_type
543
- type = nil
544
- assert_nothing_raised {
545
- type = Size2Type.load_from_xml(
546
- REXML::Document.new(
547
- '<Size2>' +
548
- '<Size>2 4</Size>' +
549
- '<PosAngle unit="deg" reference="X">35</PosAngle>' +
550
- '</Size2>').root
551
- )
552
- }
553
-
554
- assert_equal(2, type.size.value[0])
555
- assert_equal(4, type.size.value[1])
556
- assert_equal('deg', type.pos_angle.unit.value)
557
- assert_equal('X', type.pos_angle.reference.value)
558
- assert_equal(35, type.pos_angle.value)
559
- end
560
-
561
- def test_vector2_coordinate_type
562
- type = nil
563
- assert_nothing_raised {
564
- type = Vector2CoordinateType.load_from_xml(
565
- REXML::Document.new(
566
- '<Vector2Coordinate>' +
567
- '<Name>Blah</Name>' +
568
- '<Value2>23.2 2.3</Value2>' +
569
- '<Error2>0.1 0.1</Error2><Error2>0.5 0.5</Error2>' +
570
- '<Resolution2>0.5 1</Resolution2><Resolution2>0.8 1.1</Resolution2>' +
571
- '<Size2>5 4</Size2><Size2>10 2</Size2>' +
572
- '<PixSize2>0.3 0.2</PixSize2><PixSize2>0.4 0.2</PixSize2>' +
573
- '</Vector2Coordinate>').root
574
- )
575
- }
576
-
577
- assert_equal(23.2, type.value.value.value[0])
578
- assert_equal(2.3, type.value.value.value[1])
579
- assert_equal(0.1, type.error[0].value.value[0])
580
- assert_equal(0.1, type.error[0].value.value[1])
581
- assert_equal(0.5, type.error[1].value.value[0])
582
- assert_equal(0.5, type.error[1].value.value[1])
583
- assert_equal(0.5, type.resolution[0].value.value[0])
584
- assert_equal(1, type.resolution[0].value.value[1])
585
- assert_equal(0.8, type.resolution[1].value.value[0])
586
- assert_equal(1.1, type.resolution[1].value.value[1])
587
- assert_equal(5, type.size[0].value.value[0])
588
- assert_equal(4, type.size[0].value.value[1])
589
- assert_equal(10, type.size[1].value.value[0])
590
- assert_equal(2, type.size[1].value.value[1])
591
- assert_equal(0.3, type.pix_size[0].value.value[0])
592
- assert_equal(0.2, type.pix_size[0].value.value[1])
593
- assert_equal(0.4, type.pix_size[1].value.value[0])
594
- assert_equal(0.2, type.pix_size[1].value.value[1])
595
- end
596
-
597
- def test_size3_type
598
- type = nil
599
- assert_nothing_raised {
600
- type = Size3Type.load_from_xml(
601
- REXML::Document.new(
602
- '<Size3>' +
603
- '<Size>2 4 6</Size>' +
604
- '<PosAngle1 unit="deg" reference="X">35</PosAngle1>' +
605
- '<PosAngle2 unit="deg" reference="X">21.1</PosAngle2>' +
606
- '</Size3>').root
607
- )
608
- }
609
-
610
- assert_equal(2, type.size.value[0])
611
- assert_equal(4, type.size.value[1])
612
- assert_equal(6, type.size.value[2])
613
- assert_equal('deg', type.pos_angle1.unit.value)
614
- assert_equal('X', type.pos_angle1.reference.value)
615
- assert_equal(35, type.pos_angle1.value)
616
- assert_equal('deg', type.pos_angle2.unit.value)
617
- assert_equal('X', type.pos_angle2.reference.value)
618
- assert_equal(21.1, type.pos_angle2.value)
619
- end
620
- end