lib/ctioga2/data/backends/backends/text.rb in ctioga2-0.2 vs lib/ctioga2/data/backends/backends/text.rb in ctioga2-0.3
- old
+ new
@@ -23,11 +23,11 @@
# For separated sets
require 'stringio'
module CTioga2
- Version::register_svn_info('$Revision: 191 $', '$Date: 2010-11-07 15:53:08 +0100 (Sun, 07 Nov 2010) $')
+ Version::register_svn_info('$Revision$', '$Date$')
module Data
# A module for easy use of NaN in operations
@@ -53,11 +53,11 @@
}
include Dobjects
describe 'text', 'Text format', <<EOD
-This backend can read text files in a format close to the one understood
+This backend reads text files in a format close to the one understood
by gnuplot and the like.
EOD
# Inherit the baseline handling, can be useful !
# inherit_parameters :base_line
@@ -287,10 +287,15 @@
# \todo There should be a real global handling of meta-data
# extracted from files, so that they could be included for
# instance in the automatic labels ? (and we could have fun
# improving this one ?)
#
+ # @todo There should be a way to read pure text columns and
+ # use them somehow, to annotate the output ? This should be
+ # implemented at the Tioga level, though (both for reading, in
+ # fancy_read, and for using hover stuff)
+ #
# \warning This needs Tioga r561
def read_file(file)
if file =~ /(.*)@.*/
file = $1
end
@@ -359,21 +364,10 @@
# _compute_formulas_ is true, the column specification is
# taken to be a formula (in the spirit of gnuplot's)
def get_data_column(column, compute_formulas = false,
parameters = nil, header = nil)
if compute_formulas
- formula = column
- if parameters
- for k,v in parameters
- formula.gsub!(/\b#{k}\b/, v.to_s)
- end
- end
- formula.gsub!(/\$(\d+)/, 'column[\1]')
- if header
- for k,v in header
- formula.gsub!("$#{k}$", "column[#{v}]")
- end
- end
+ formula = Utils::parse_formula(column, parameters, header)
debug { "Using formula #{formula} for column spec: #{column}" }
return Dvector.compute_formula(formula,
@current_data,
@included_modules)
else