Class: VORuby::STC::V1_10::Coords::AstroCoordsFile
- Inherits:
-
Object
- Object
- VORuby::STC::V1_10::Coords::AstroCoordsFile
- Includes:
- SerializableToXml
- Defined in:
- lib/voruby/stc/1.10/coords.rb
Overview
Coordinate references to a specific FITS file
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#position ⇒ Object
Returns the value of attribute position.
-
#redshift ⇒ Object
Returns the value of attribute redshift.
-
#spectral ⇒ Object
Returns the value of attribute spectral.
-
#time ⇒ Object
Returns the value of attribute time.
-
#velocity ⇒ Object
Returns the value of attribute velocity.
Class Method Summary collapse
Instance Method Summary collapse
- #==(c) ⇒ Object
-
#initialize(options = {}) ⇒ AstroCoordsFile
constructor
A new instance of AstroCoordsFile.
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(options = {}) ⇒ AstroCoordsFile
Returns a new instance of AstroCoordsFile.
1898 1899 1900 1901 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1898 def initialize(={}) raise_argument_required_error('file') if !.has_key?(:file) .each { |key, value| send("#{key}=", value) } end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
1896 1897 1898 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1896 def file @file end |
#position ⇒ Object
Returns the value of attribute position.
1896 1897 1898 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1896 def position @position end |
#redshift ⇒ Object
Returns the value of attribute redshift.
1896 1897 1898 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1896 def redshift @redshift end |
#spectral ⇒ Object
Returns the value of attribute spectral.
1896 1897 1898 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1896 def spectral @spectral end |
#time ⇒ Object
Returns the value of attribute time.
1896 1897 1898 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1896 def time @time end |
#velocity ⇒ Object
Returns the value of attribute velocity.
1896 1897 1898 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1896 def velocity @velocity end |
Class Method Details
.from_xml(xml) ⇒ Object
1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1949 def self.from_xml(xml) root = element_from(xml) = { :file => Fits.from_xml(REXML::XPath.first(root, 'x:FITSFile', {'x' => obj_ns.uri})), } time = REXML::XPath.first(root, 'x:FITSTime', {'x' => obj_ns.uri}) [:time] = CoordFitsColumns.from_xml(time) if time position = REXML::XPath.first(root, 'x:FITSPosition', {'x' => obj_ns.uri}) [:position] = CoordFitsColumns.from_xml(position) if position velocity = REXML::XPath.first(root, 'x:FITSVelocity', {'x' => obj_ns.uri}) [:velocity] = CoordFitsColumns.from_xml(velocity) if velocity spectral = REXML::XPath.first(root, 'x:FITSSpectral', {'x' => obj_ns.uri}) [:spectral] = CoordFitsColumns.from_xml(spectral) if spectral redshift = REXML::XPath.first(root, 'x:FITSRedshift', {'x' => obj_ns.uri}) [:redshift] = CoordFitsColumns.from_xml(redshift) if redshift AstroCoordsFile.new() end |
Instance Method Details
#==(c) ⇒ Object
1974 1975 1976 1977 1978 1979 1980 1981 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1974 def ==(c) self.file == c.file and self.time == c.time and self.position == c.position and self.velocity == c.velocity and self.spectral == c.spectral and self.redshift == c.redshift end |
#to_xml(name = nil) ⇒ Object
1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1934 def to_xml(name=nil) el = element(name) el.add_element(self.file.to_xml('FITSFile')) el.add_element(self.time.to_xml('FITSTime')) if self.time el.add_element(self.position.to_xml('FITSPosition')) if self.position el.add_element(self.velocity.to_xml('FITSVelocity')) if self.velocity el.add_element(self.spectral.to_xml('FITSSpectral')) if self.spectral el.add_element(self.redshift.to_xml('FITSRedshift')) if self.redshift collapse_namespaces(el) el end |