Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency cleanup #393

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mpisppy/convergers/primal_dual_converger.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import numpy as np
import os
import pandas as pd
import matplotlib.pyplot as plt
import mpisppy.convergers.converger
from mpisppy import MPI
from mpisppy.extensions.phtracker import TrackedData
Expand Down Expand Up @@ -141,6 +140,9 @@ def plot_results(self):
Plot the results of the convergence checks
by reading in csv file and plotting
"""
# don't create a hard dependency on matplotlib
import matplotlib.pyplot as plt

plot_fname = self.tracker.plot_fname
conv_data = pd.read_csv(self.tracker.fname)

Expand All @@ -159,4 +161,4 @@ def post_everything(self):
Reading the convergence data and plotting the results
'''
if self.tracking and self._rank == 0:
self.plot_results()
self.plot_results()
4 changes: 3 additions & 1 deletion mpisppy/extensions/phtracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Must use the PH object for this to work
'''
import ast
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
Expand Down Expand Up @@ -411,6 +410,9 @@ def add_xbars(self, final=False):
def plot_gaps(self, var):
''' plot the gaps; Assumes gaps are saved in a csv file
'''
# only import this if needed so we
# don't create a hard dependency
import matplotlib.pyplot as plt


df = pd.read_csv(self.track_dict[var].fname, sep=',')
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
'numpy<2',
'scipy',
'pyomo>=6.4',
'pandas', # should probably remove
],
extras_require={
'doc': [
Expand Down
Loading