Skip to content

Commit

Permalink
Move all imports of plotting libraries into function scope (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
ketozhang authored Sep 26, 2024
1 parent b0789be commit b866f00
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pyLIMA/fits/DEMC_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import emcee
import numpy as np
from pyLIMA.fits.ML_fit import MLfit
from pyLIMA.outputs import pyLIMA_plots
from pyLIMA.priors import parameters_priors


Expand Down Expand Up @@ -142,7 +141,7 @@ def fit(self, initial_population=[], computational_pool=False):
'DEMC_chains': DEMC_chains, 'fit_time': computation_time}

def fit_outputs(self):

from pyLIMA.outputs import pyLIMA_plots
pyLIMA_plots.plot_lightcurves(self.model, self.fit_results['best_model'])
pyLIMA_plots.plot_geometry(self.model, self.fit_results['best_model'])

Expand Down
4 changes: 2 additions & 2 deletions pyLIMA/fits/ML_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import numpy as np
import pyLIMA.fits.objective_functions as objective_functions
from bokeh.layouts import gridplot
from bokeh.plotting import output_file, save
from pyLIMA.priors import parameters_boundaries
from pyLIMA.priors import parameters_priors

Expand Down Expand Up @@ -1254,6 +1252,8 @@ def fit_outputs(self, bokeh_plot=None):
implemented yet)
bokeh_figure : bokehh.fig, a bokeh.figure containing all the above
"""
from bokeh.layouts import gridplot
from bokeh.plotting import output_file, save
from pyLIMA.outputs import pyLIMA_plots

matplotlib_lightcurves = None
Expand Down
2 changes: 1 addition & 1 deletion pyLIMA/outputs/pyLIMA_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import matplotlib.pyplot as plt
import numpy as np
import pyLIMA.fits.objective_functions
import pygtc
from bokeh.layouts import gridplot
from bokeh.models import Arrow, OpenHead
from bokeh.models import BasicTickFormatter
Expand Down Expand Up @@ -1188,6 +1187,7 @@ def plot_residuals(figure_axe, microlensing_model, model_parameters, bokeh_plot=


def plot_distribution(samples, parameters_names=None, bokeh_plot=None):
import pygtc
names = [str(i) for i in range(len(parameters_names))]
try:
GTC = pygtc.plotGTC(chains=[samples], sigmaContourLevels=True, paramNames=names,
Expand Down

0 comments on commit b866f00

Please sign in to comment.