diff --git a/addie/processing/mantid/master_table/mass_density_handler.py b/addie/processing/mantid/master_table/mass_density_handler.py index 3b4e64e1..ca2b0b98 100644 --- a/addie/processing/mantid/master_table/mass_density_handler.py +++ b/addie/processing/mantid/master_table/mass_density_handler.py @@ -35,8 +35,8 @@ class MassDensityWindow(QMainWindow): chemical_formula_defined = False geometry_dimensions_defined = False - total_number_of_atoms = np.NaN - total_molecular_mass = np.NaN + total_number_of_atoms = np.nan + total_molecular_mass = np.nan column = 0 diff --git a/addie/processing/mantid/master_table/master_table_exporter.py b/addie/processing/mantid/master_table/master_table_exporter.py index d7275b1c..1edbcdc8 100755 --- a/addie/processing/mantid/master_table/master_table_exporter.py +++ b/addie/processing/mantid/master_table/master_table_exporter.py @@ -24,17 +24,17 @@ }, }, "Material": "", - "Density": {"MassDensity": np.NaN, + "Density": {"MassDensity": np.nan, "UseMassDensity": True, - "NumberDensity": np.NaN, + "NumberDensity": np.nan, "UseNumberDensity": False, - "Mass": np.NaN, + "Mass": np.nan, "UseMass": False}, - "PackingFraction": np.NaN, + "PackingFraction": np.nan, "Geometry": {"Shape": "", - "Radius": np.NaN, - "Radius2": np.NaN, - "Height": np.NaN, + "Radius": np.nan, + "Radius2": np.nan, + "Height": np.nan, }, "AbsorptionCorrection": {"Type": "", }, @@ -60,7 +60,7 @@ "Sample": copy.deepcopy(_element), "Normalization": copy.deepcopy(_element), "Calibration": {"Filename": ""}, - "HighQLinearFitRange": np.NaN, + "HighQLinearFitRange": np.nan, "Merging": {"QBinning": [], "SumBanks": [], "Characterizations": "", @@ -104,7 +104,7 @@ def __init__(self, parent=None): self.calibration = str(self.parent.processing_ui.calibration_file.text()) - self.NA_list = ["None", "N/A", "", np.NaN] + self.NA_list = ["None", "N/A", "", np.nan] def export(self, filename='', row=None): """create dictionary of all rows unless `row` argument is specified, @@ -293,11 +293,11 @@ def _retrieve_element_infos(self, element='sample', row=-1): radius2 = str( self.parent.master_table_list_ui[key][element]['geometry']['radius2']['value'].text()) - dict_element["Geometry"]["Radius"] = np.NaN if ( + dict_element["Geometry"]["Radius"] = np.nan if ( radius in self.__nan_list) else float(radius) - dict_element["Geometry"]["Radius2"] = np.NaN if ( + dict_element["Geometry"]["Radius2"] = np.nan if ( radius2 in self.__nan_list) else float(radius2) - dict_element["Geometry"]["Height"] = np.NaN if ( + dict_element["Geometry"]["Height"] = np.nan if ( height in self.__nan_list) else float(height) column += 1 @@ -613,20 +613,20 @@ def density_selection_for_reduction(self, dictionary): # key dictionary.pop('Density') - dictionary['MassDensity'] = np.NaN if (mass_density in self.__nan_list) else float(mass_density) + dictionary['MassDensity'] = np.nan if (mass_density in self.__nan_list) else float(mass_density) return dictionary def _remove_keys_from_with_nan_values( self, dictionary, selected_values=None): - """Remove keys in a dictionary if the value is NaN + """Remove keys in a dictionary if the value is nan :param dictionary: Dictionary with keys we want to check :type dictionary: dict :param selected_values: Dictionary with keys we want to check :type dictionary: dict - :return: Dictionary with keys removed where value is NaN + :return: Dictionary with keys removed where value is nan :rtype: dict """ # Set default to check all keys unless selected_values defined @@ -643,7 +643,7 @@ def _remove_keys_from_with_nan_values( ",".join(dictionary.keys())) raise Exception(err_string) - # Remove keys with NaN values + # Remove keys with nan values for key in selected_values: try: if np.isnan(dictionary[key]): @@ -727,7 +727,7 @@ def geometry_selection_for_reduction(self, dictionary): print("No Geometry found, default geometry added:", geometry) return dictionary - # Remove all NaN values from Geometry + # Remove all nan values from Geometry dictionary['Geometry'] = self._remove_keys_from_with_nan_values( dictionary['Geometry']) diff --git a/addie/processing/mantid/master_table/table_row_handler.py b/addie/processing/mantid/master_table/table_row_handler.py index bd0dff12..69f19e0e 100755 --- a/addie/processing/mantid/master_table/table_row_handler.py +++ b/addie/processing/mantid/master_table/table_row_handler.py @@ -228,8 +228,8 @@ def insert_row(self, row=-1, _mass_density_infos = {'number_density': copy.deepcopy(_mass_density_options), 'mass_density': copy.deepcopy(_mass_density_options), 'mass': copy.deepcopy(_mass_density_options), - 'molecular_mass': np.NaN, - 'total_number_of_atoms': np.NaN, + 'molecular_mass': np.nan, + 'total_number_of_atoms': np.nan, } _material_infos = {'mantid_format': None, 'addie_format': None} diff --git a/addie/utilities/math_tools.py b/addie/utilities/math_tools.py index 6b3fad08..499e1ace 100644 --- a/addie/utilities/math_tools.py +++ b/addie/utilities/math_tools.py @@ -78,7 +78,7 @@ def oneAndOnlyOneTrue(iterable): raise -def volume_of_cylinder(radius=np.NaN, height=np.NaN): +def volume_of_cylinder(radius=np.nan, height=np.nan): """Computes volume of a cylinder :param radius: Radius of cylinder (in units of length) @@ -92,7 +92,7 @@ def volume_of_cylinder(radius=np.NaN, height=np.NaN): return np.float(np.pi) * np.float(radius)**2 * np.float(height) -def volume_of_sphere(radius=np.NaN): +def volume_of_sphere(radius=np.nan): """Computes volume of a sphere :param radius: Radius of sphere (in units of length) @@ -105,9 +105,9 @@ def volume_of_sphere(radius=np.NaN): def volume_of_hollow_cylinder( - inner_radius=np.NaN, - outer_radius=np.NaN, - height=np.NaN): + inner_radius=np.nan, + outer_radius=np.nan, + height=np.nan): """Computes volume of a hollow cylinder :param inner_radius: Inner radius of cylinder (in units of length)