Package pylal :: Module ligolw_sqlutils :: Class parse_param_ranges
[hide private]
[frames] | no frames]

Class parse_param_ranges

source code

Instance Methods [hide private]
 
__init__(self, table_name, table_param, param_ranges_opt, verbose=False)
Parse --param-ranges option.
source code
 
get_param_name(self) source code
 
get_param_ranges(self) source code
 
get_param_filters(self)
Converts param_ranges into a list of strings that can be used in a SQLite WHERE clause.
source code
 
group_by_param_range(self, param_value)
Takes in a value and returns a number corresponding to which value param_range it falls in.
source code
 
param_range_by_group(self, group_num)
Takes in a group number as returned by group_by_param_range and returns a string representing that group.
source code
Method Details [hide private]

__init__(self, table_name, table_param, param_ranges_opt, verbose=False)
(Constructor)

source code 

Parse --param-ranges option. Creates self.param which is the table_name and
the table_param appended together (with a '.') and self.param_ranges, which is
a list of tuples that give the lower parameter value, whether it is an open or
closed boundary, and the same for the upper parameter. For example, if 
table_name is coinc_inspiral, table_param is mchirp and param_ranges_opt 
is '[2,8);[8,17]' will get:
self.param = 'coinc_inspiral.mchirp'
self.param_ranges = 
  [ ( ('>=',2.0), ('<',8.0) ),
    ( ('>=',8.0), ('<=', 17.0) ) ]

@table_name: Name of coinc_table in which the desired parameter is a column.
@table_param: Parameter in the table on which to separate rows.
@param_ranges_opt: string from the --param-ranges option. Param-ranges must
 follow these format rules:
    * A '(' or ')' implies an open boundary, a '[' or ']' a closed boundary.
    * To specify multiple ranges, separate each range by a ';'.
    * To specify equal to a single value, just specify the value, e.g., '2.3'
    * To specify not-equal to a single value, put a ! infront of the value, e.g., '!2.3'.
@verbose: be verbose

get_param_filters(self)

source code 

Converts param_ranges into a list of strings that can be used in 
a SQLite WHERE clause. For example, if table_name is coinc_inspiral, 
table_param is mchirp and param_ranges_opt is '[2,8);[8,17]' the 
elements in the returned list will be:
['coinc_inspiral.mchirp >= 2.0 AND coinc_inspiral.mchirp < 8.0',
 'coinc_inspiral.mchirp >= 8.0 AND coinc_inspiral.mchirp <= 17.0']