def imageplot(d, ranges=None, cmap=pyplot.cm.gray, aspect=None, vmin=None, vmax=None, title=None): """ Image plotter for mspass ensemble objects. """ # We have to handle 3C ensembles specially to make 3 separate # windows. this logic is potentially confusing. the else # block handles all but 3C ensembles - common read structure # makes a single plot call work for all 3 cases figure_handles = [] if isinstance(d, SeismogramEnsemble): # We always plot 3C data as 3 windows. We extract each # component and then call this function with a trivial # recursion - only call itself once and only once title3c = title for i in range(3): pyplot.figure(i) dcomp = EnsembleComponent(d, i) if title != None: title3c = "%s:%d" % (title, i) try: [t0, dt, section] = tse2nparray(dcomp) image_raw(section, t0, dt, ranges, cmap, aspect, vmin, vmax) if title3c != None: pyplot.title(title3c) figure_handles.append(pyplot.gcf()) except RuntimeError as err: print(err) return None else: try: # need to force these into the scope of this block plotdata = [] if isinstance(d, TimeSeriesEnsemble): plotdata = tse2nparray(d) elif isinstance(d, Seismogram): plotdata = seis2nparray(d) elif isinstance(d, TimeSeries): plotdata = ts2nparray(d) else: raise RuntimeError( "wtvaplot - data received is not one supported by mspass") t0 = plotdata[0] dt = plotdata[1] section = plotdata[2] image_raw(section, t0, dt, ranges, cmap, aspect, vmin, vmax) if title != None: pyplot.title(title) figure_handles.append(pyplot.gcf()) except RuntimeError as err: print(err) return None return figure_handles
def _imageplot_SeismogramEnsemble(self, d): # implement by call to EnsembleComponent and calling TimeSeriesEnsemble method 3 times # should return a list of 3 gcf handles figure_handles = [] for k in range(3): dcomp = EnsembleComponent(d, k) pyplot.figure(k) figure = self._imageplot(dcomp) figure_handles.append(figure) # pyplot.show() return figure_handles
def _wtva_SeismogramEnsemble(self, d, fill): # implement by call to EnsembleComponent and calling TimeSeriesEnsemble method 3 times # should return a list of 3 gcf handles figure_handles = [] for k in range(3): dcomp = EnsembleComponent(d, k) # figure_title='Component %d' % k # pyplot.figure(figure_title) pyplot.figure(k) handle = self._wtva(dcomp) figure_handles.append(handle) # pyplot.show() return figure_handles