Skip to content

Commit

Permalink
Make ROOT an optional import
Browse files Browse the repository at this point in the history
  • Loading branch information
francois-drielsma committed Sep 13, 2024
1 parent e3d295d commit ca784a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spine/io/read/larcv.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Contains a reader class dedicated to loading data from LArCV files."""

import numpy as np
import ROOT

from spine.utils.decorators import inherit_docstring
from spine.utils.conditional import ROOT

from .base import ReaderBase

Expand Down
6 changes: 6 additions & 0 deletions spine/utils/conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
import os
from warnings import warn

# If ROOT is available, load it
try:
import ROOT
except ModuleNotFoundError:
warn("ROOT could not be found, cannot parse LArCV data.")
ROOT = None

# If LArCV is available, load it
try:
Expand Down

0 comments on commit ca784a3

Please sign in to comment.