Skip to content

Commit

Permalink
Feature #2545 interest_bounds (#2546)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway authored May 18, 2023
1 parent e527ab5 commit 77261b9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/Users_Guide/mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ _____________________
inten_perc_ratio = ratio_if;
}
The set of interest function entries listed above define which values are of interest for each pairwise attribute measured. The interest functions may be defined as a piecewise linear function or as an algebraic expression. A piecewise linear function is defined by specifying the corner points of its graph. An algebraic function may be defined in terms of several built-in mathematical functions. See :numref:`MODE_A-Scientific-and-statistical` for how interest values are used by the fuzzy logic engine. By default, many of these functions are defined in terms of the previously defined **grid_res** entry.
The interest function entries listed above define which values are of interest for each pairwise attribute measured. Each interest function is defined as a piecewise linear function by specifying the corner points of its graph. The range of each function must be within **0** and **1**. Including (x, y) points with y-values outside this range results in a runtime error. See :numref:`MODE_A-Scientific-and-statistical` for how interest values are used by the fuzzy logic engine. By default, many of these functions are defined in terms of the previously defined **grid_res** entry.


_____________________
Expand Down
59 changes: 48 additions & 11 deletions src/libcode/vx_shapedata/mode_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -468,16 +468,16 @@ PlotInfo plot_info;

// Parse the interest functions

centroid_dist_if = dict->lookup_pwl(conf_key_centroid_dist);
boundary_dist_if = dict->lookup_pwl(conf_key_boundary_dist);
convex_hull_dist_if = dict->lookup_pwl(conf_key_convex_hull_dist);
angle_diff_if = dict->lookup_pwl(conf_key_angle_diff);
aspect_diff_if = dict->lookup_pwl(conf_key_aspect_diff);
area_ratio_if = dict->lookup_pwl(conf_key_area_ratio);
int_area_ratio_if = dict->lookup_pwl(conf_key_int_area_ratio);
curvature_ratio_if = dict->lookup_pwl(conf_key_curvature_ratio);
complexity_ratio_if = dict->lookup_pwl(conf_key_complexity_ratio);
inten_perc_ratio_if = dict->lookup_pwl(conf_key_inten_perc_ratio);
centroid_dist_if = parse_interest_function(dict, conf_key_centroid_dist);
boundary_dist_if = parse_interest_function(dict, conf_key_boundary_dist);
convex_hull_dist_if = parse_interest_function(dict, conf_key_convex_hull_dist);
angle_diff_if = parse_interest_function(dict, conf_key_angle_diff);
aspect_diff_if = parse_interest_function(dict, conf_key_aspect_diff);
area_ratio_if = parse_interest_function(dict, conf_key_area_ratio);
int_area_ratio_if = parse_interest_function(dict, conf_key_int_area_ratio);
curvature_ratio_if = parse_interest_function(dict, conf_key_curvature_ratio);
complexity_ratio_if = parse_interest_function(dict, conf_key_complexity_ratio);
inten_perc_ratio_if = parse_interest_function(dict, conf_key_inten_perc_ratio);

// Conf: total_interest_thresh

Expand All @@ -487,7 +487,7 @@ PlotInfo plot_info;

if(total_interest_thresh < 0 || total_interest_thresh > 1) {
mlog << Error << "\nModeConfInfo::process_config() -> "
<< "total_interest_thresh (" << total_interest_thresh
<< "\"total_interest_thresh\" (" << total_interest_thresh
<< ") must be set between 0 and 1.\n\n";
exit(1);
}
Expand Down Expand Up @@ -644,6 +644,43 @@ return;
////////////////////////////////////////////////////////////////////////


PiecewiseLinear * ModeConfInfo::parse_interest_function(Dictionary * dict, const char * conf_key_if)

{

//
// lookup piecewise linear interest function
//

PiecewiseLinear * pwl_if = dict->lookup_pwl(conf_key_if);

//
// range check the points
//

for (int j=0; j<pwl_if->n_points(); ++j) {

if ( pwl_if->y(j) < 0 || pwl_if->y(j) > 1 ) {

mlog << Error << "\nModeConfInfo::parse_interest_function() -> "
<< "all \"" << conf_key_if << "\" interest function points ("
<< pwl_if->x(j) << ", " << pwl_if->y(j)
<< ") must be in the range of 0 and 1.\n\n";

exit(1);

}

} // for j

return ( pwl_if );

}


////////////////////////////////////////////////////////////////////////


void ModeConfInfo::set_field_index(int k)

{
Expand Down
2 changes: 2 additions & 0 deletions src/libcode/vx_shapedata/mode_conf_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ class ModeConfInfo {

void read_fields (Mode_Field_Info * &, Dictionary * dict, GrdFileType, char _fo);

PiecewiseLinear * parse_interest_function(Dictionary * dict, const char * conf_key_if);

//
// weights
//
Expand Down

0 comments on commit 77261b9

Please sign in to comment.