Skip to content

Workaround: Pin pandas <3 due to neutronbraggedge incompatibility #340

@KedoKudo

Description

@KedoKudo

Summary

iBeatles v1.2.1 includes a workaround that pins pandas <3 in the conda recipe to avoid a crash on startup.

Root Cause

The neutronbraggedge package uses positional indexing with [] on pandas Series objects, which fails in pandas 3.0:

# neutronbraggedge/material_handler/retrieve_material_metadata.py:68
self.lattice = float(_metadata[0])  # Fails in pandas 3.0

In pandas 3.0, [] is strictly for label-based access. Positional access requires .iloc[]:

self.lattice = float(_metadata.iloc[0])  # Correct

Affected Files in neutronbraggedge

  1. retrieve_material_metadata.py:68,72 - Uses _metadata[0] and _metadata[1]
  2. braggedge.py:249 - if file_type is 'csv': (SyntaxWarning, should use ==)
  3. tof.py:61 - if units is not 's': (SyntaxWarning, should use !=)

Proper Fix

The proper fix should be implemented in the upstream neutronbraggedge package:

Workaround in iBeatles

Until the upstream fix is released, iBeatles pins pandas <3 in conda.recipe/meta.yaml.

Related

  • See upstream issue: (to be created in BraggEdge repo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions