Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • A Alex_Project
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Zhang, Yuanpeng
  • Alex_Project
  • Issues
  • #17

Closed
Open
Created Jun 21, 2021 by Zhang, Yuanpeng@y8z⭐Owner

[Task] Solve the issue with the transformation between mass and number density

  1. Locate where the issue happens.

    • At line-202 in addie/processing/mantid/master_table/mass_density_handler.py, there occurs error when calling number_density_value_changed,
      File "/SNS/users/y8z/miniconda/envs/addie_env_3/lib/python3.6/site-packages/addie/utilities/math_tools.py", line 200, in number_density2mass_density
        mass_density = number_density * molecular_mass / natoms / avogadro_term
    TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
    • We know from the error message that the error should be something to do with that some of the variables used in the math calculation is None (i.e. no value assigned). Anyhow, we need to trace further back, by searching for number_density2mass_density.

    • All parameters passed to number_density2mass_density are given in the function number_density_value_changed defined in addie/processing/mantid/master_table/mass_density_handler.py. From there, we know, there may be something wrong with either self.total_number_of_atoms or self.total_molecular_mass.

    • Further searching for, e.g, self.total_molecular_mass in ./processing/mantid/master_table/mass_density_handler.py, we know that self.total_molecular_mass is assigned value at line-87 in addie/processing/mantid/master_table/mass_density_handler.py and the value comes from the function call to retrieving_molecular_mass_and_number_of_atoms_worked.

    • Further searching for retrieving_molecular_mass_and_number_of_atoms_worked will lead us to addie/processing/mantid/master_table/periodic_table/material_handler.py.

    • Checking the codes will lead us further to get_periodictable_formatted_element_and_number_of_atoms in addie/processing/mantid/master_table/periodic_table/material_handler.py.

    • We realize that there are three return parameters from get_periodictable_formatted_element_and_number_of_atoms, but when we check the value assignment in retrieving_molecular_mass_and_number_of_atoms_worked, we found there are only two receivers.

  2. Solve the issue.

    • The solution should be straightforward to change the following line in addie/processing/mantid/master_table/periodic_table/material_handler.py,

      [formated_element, number_of_atoms] = get_periodictable_formatted_element_and_number_of_atoms(
          _element)

      to

      [formated_element, number_of_atoms, case] = get_periodictable_formatted_element_and_number_of_atoms(
          _element)
Edited Jun 21, 2021 by Zhang, Yuanpeng
Assignee
Assign to
Time tracking