Skip to content

Commit

Permalink
Always include numpy in Python script exports as with Numpy 2.0 scala…
Browse files Browse the repository at this point in the history
…rs are often represented as np.float64(...)
  • Loading branch information
astrofrog committed Jul 12, 2024
1 parent 5e92185 commit 262671d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions glue/viewers/common/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ def export_as_script(self, filename):

imports = ['from glue.core.state import load']

# Always include Numpy because as of Numpy 2.0, scalars are sometimes
# represented in string form as e.g. np.float64(...)
imports += ['import numpy as np']

imports_header, header = self._script_header()
imports.extend(imports_header)

Expand Down

0 comments on commit 262671d

Please sign in to comment.