diff --git a/pyglance/glance/compare.py b/pyglance/glance/compare.py index 04c93ccdfc82e0239a741365d11fcc8a0ee4892e..2b1e5c86a8ae6e12ae2ee4472efae8b130bf2c75 100644 --- a/pyglance/glance/compare.py +++ b/pyglance/glance/compare.py @@ -1181,6 +1181,7 @@ def reportGen_library_call (a_path, b_path, var_list=[ ], LOG.debug("Variable directory (" + variableDir + ") does not exist.") LOG.debug("Creating variable directory.") os.makedirs(variableDir) + varRunInfo['doc_path'] = quote(os.path.join(pathsTemp['out'], './' + 'doc.html')) # should this be somewhere else? # figure out the masks we want, and then do our statistical analysis mask_a_to_use = None diff --git a/pyglance/glance/data.py b/pyglance/glance/data.py index 5d4c25315878a461f9923b801669f72aad44872e..0a5d36bf56099f4729ecabaa663a889fd484d7a0 100644 --- a/pyglance/glance/data.py +++ b/pyglance/glance/data.py @@ -181,8 +181,10 @@ class DiffInfoObject (object) : # figure out the shared type type_to_return = data1.dtype + changed_type = False if data1.dtype is not data2.dtype: type_to_return = np.common_type(data1, data2) + changed_type = True # upcast the type if we need to if type_to_return in DiffInfoObject.DATATYPE_UPCASTS : @@ -193,21 +195,30 @@ class DiffInfoObject (object) : # figure out the fill value fill_value_to_return = None - # if we're looking at float or complex data, use a nan - if (np.issubdtype(type_to_return, np.float) or - np.issubdtype(type_to_return, np.complex)) : - fill_value_to_return = np.nan - - # if we're looking at int data, use the minimum value - elif np.issubdtype(type_to_return, np.int) : - fill_value_to_return = np.iinfo(type_to_return).min - - # if we're looking at unsigned data, use the maximum value - elif ((type_to_return is np.uint8) or - (type_to_return is np.uint16) or - (type_to_return is np.uint32) or - (type_to_return is np.uint64)) : - fill_value_to_return = np.iinfo(type_to_return).max + # if both of the old fill values exist and are the same, use them + if (fill1 is not None) and (fill1 == fill2) : + + fill_value_to_return = fill1 + if changed_type : + fill_value_to_return = type_to_return(fill_value_to_return) + + else: + + # if we're looking at float or complex data, use a nan + if (np.issubdtype(type_to_return, np.float) or + np.issubdtype(type_to_return, np.complex)) : + fill_value_to_return = np.nan + + # if we're looking at int data, use the minimum value + elif np.issubdtype(type_to_return, np.int) : + fill_value_to_return = np.iinfo(type_to_return).min + + # if we're looking at unsigned data, use the maximum value + elif ((type_to_return is np.uint8) or + (type_to_return is np.uint16) or + (type_to_return is np.uint32) or + (type_to_return is np.uint64)) : + fill_value_to_return = np.iinfo(type_to_return).max return type_to_return, fill_value_to_return diff --git a/pyglance/glance/stats.py b/pyglance/glance/stats.py index e748740784750e5d6e516673b88187b94e510069..d75921ac5fa7ffaf18aedb59f080392082f7cea8 100644 --- a/pyglance/glance/stats.py +++ b/pyglance/glance/stats.py @@ -496,11 +496,18 @@ class NumericalComparisonStatistics (StatisticalData) : if (include_basic_analysis) : basic_dict = NumericalComparisonStatistics.basic_analysis(diffInfoObject.diff_data_object.data, valid_in_both) - self.rms_diff = basic_dict['rms_diff'] - self.std_diff = basic_dict['std_diff'] - self.mean_diff = basic_dict['mean_diff'] - self.median_diff = basic_dict['median_diff'] - self.max_diff = basic_dict['max_diff'] + if len(basic_dict) > 0 : + self.rms_diff = basic_dict['rms_diff'] + self.std_diff = basic_dict['std_diff'] + self.mean_diff = basic_dict['mean_diff'] + self.median_diff = basic_dict['median_diff'] + self.max_diff = basic_dict['max_diff'] + else : + self.rms_diff = np.nan + self.std_diff = np.nan + self.mean_diff = np.nan + self.median_diff = np.nan + self.max_diff = np.nan self.temp_analysis = basic_dict def dictionary_form(self) : diff --git a/pyglance/glance/variablereport.txt b/pyglance/glance/variablereport.txt index f244599970c76d188ec0fb1bbc68dc320d861d6d..abcdc0d2245570ca40c1d6f1dbfee57830c496a2 100644 --- a/pyglance/glance/variablereport.txt +++ b/pyglance/glance/variablereport.txt @@ -190,7 +190,7 @@ Copyright (c) 2009 University of Wisconsin SSEC. All rights reserved. </dt> <dd> % for statName, statValue in sorted(list(dataSet.items())) : - ${statName}<a href="../doc.html">*</a>: ${report.make_formatted_display_string(statValue)} <br> + ${statName}<a href="${runInfo['doc_path']}">*</a>: ${report.make_formatted_display_string(statValue)} <br> % endfor <br> <dd>