Skip to content

KeyError when accessing section_text for certain sections #17

Description

@ahnaf-tahmid-chowdhury

Description

I encountered a KeyError while trying to access specific sections of an ENDF material. Below is a summary of the issue:

Steps to Reproduce:

  1. Load a material using endf.Material(), for example:

    import endf
    mat = endf.Material('n-092_U_235.endf')
  2. The following warnings appear:

    /path/to/venv/lib/python3.12/site-packages/endf/material.py:228: UserWarning: MF=31, MT=452 ignored
      warn(f"{MF=}, {MT=} ignored")
    /path/to/venv/lib/python3.12/site-packages/endf/material.py:228: UserWarning: MF=31, MT=456 ignored
      warn(f"{MF=}, {MT=} ignored")
    /path/to/venv/lib/python3.12/site-packages/endf/material.py:228: UserWarning: MF=35, MT=18 ignored
      warn(f"{MF=}, {MT=} ignored")
    
  3. Attempt to access a specific section:

    print(mat.section_text[12, 75])

    This raises the following error:

    KeyError: (12, 75)
    
  4. Attempting to access other sections like:

    mat.section_data[3, 16]

    works as expected and returns data.

Expected Behavior:

mat.section_text[12, 75] should return the corresponding section data, or provide a clearer error if this section is not available.

Actual Behavior:

A KeyError is raised when trying to access section_text for certain sections.

System Information:

  • Python version: 3.12
  • endf version: 0.1.4 through pip
  • ENDF file used: n-092_U_235.endf

Additional Context:

The warnings related to MF=31 and MF=35 might be linked to the issue, but it's unclear if this is the cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions