From 6a1d6ecc406aeff90b51ef4ed792fc312377c66c Mon Sep 17 00:00:00 2001 From: Radek Poleski Date: Thu, 21 Dec 2017 20:38:52 -0500 Subject: [PATCH] alpha_list added in model.py plot functions --- source/MulensModel/model.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/source/MulensModel/model.py b/source/MulensModel/model.py index db49d26b..6775a92a 100644 --- a/source/MulensModel/model.py +++ b/source/MulensModel/model.py @@ -419,7 +419,7 @@ def reset_plot_properties(self): def _store_plot_properties( self, color_list=None, marker_list=None, size_list=None, - label_list=None, **kwargs): + label_list=None, alpha_list=None, **kwargs): """ Store plot properties for each data set. """ @@ -431,6 +431,8 @@ def _store_plot_properties( self.plot_properties['size_list'] = size_list if label_list is not None: self.plot_properties['label_list'] = label_list + if alpha_list is not None: + self.plot_properties['alpha_list'] = alpha_list if len(kwargs) > 0: self.plot_properties['other_kwargs'] = kwargs @@ -492,6 +494,9 @@ def _set_plot_kwargs(self, index, show_errorbars=True, bad_data=False): if 'label_list' in self.plot_properties.keys(): new_kwargs['label'] = self.plot_properties['label_list'][index] + if 'alpha_list' in self.plot_properties.keys(): + new_kwargs['alpha'] = self.plot_properties['alpha_list'][index] + if 'other_kwargs' in self.plot_properties.keys(): for (key, value) in self.plot_properties[ 'other_kwargs'].items(): @@ -507,8 +512,8 @@ def _set_plot_kwargs(self, index, show_errorbars=True, bad_data=False): def plot_data( self, data_ref=None, show_errorbars=True, show_bad=False, color_list=None, marker_list=None, size_list=None, - label_list=None, subtract_2450000=False, subtract_2460000=False, - **kwargs): + label_list=None, alpha_list=None, subtract_2450000=False, + subtract_2460000=False, **kwargs): """ Plot the data scaled to the model. @@ -538,6 +543,10 @@ def plot_data( Attaches a label to each data set, which can be used to create a legend by calling pl.legend(). + alpha_list: *list* + Alpha value for each data set: 0 for transparent through 1 + for opaque. + subtract_2450000, subtract_2460000: *boolean* If True, subtracts 2450000 or 2460000 from the time axis to get more human-scale numbers. If using, make @@ -560,7 +569,7 @@ def plot_data( self._store_plot_properties( color_list=color_list, marker_list=marker_list, - size_list=size_list, label_list=label_list, + size_list=size_list, label_list=label_list, alpha_list=alpha_list, **kwargs) # Reference flux scale @@ -631,7 +640,8 @@ def plot_data( def plot_residuals( self, show_errorbars=True, color_list=None, - marker_list=None, size_list=None, label_list=None, data_ref=None, + marker_list=None, size_list=None, label_list=None, + alpha_list=None, data_ref=None, subtract_2450000=False, subtract_2460000=False, **kwargs): """ Plot the residuals (in magnitudes) of the model. Uses the @@ -647,7 +657,7 @@ def plot_residuals( self._store_plot_properties( color_list=color_list, marker_list=marker_list, - size_list=size_list, label_list=label_list, + size_list=size_list, label_list=label_list, alpha_list=alpha_list, **kwargs) # Get fluxes for all datasets