def image(self, *args, **kwargs): if len(args) == 1: complex_z = args[0] if np.iscomplexobj(complex_z): args = (complex_z.real, ) elif len(args) == 3: complex_z = args[2] if np.iscomplexobj(complex_z): args = ( args[0], args[1], complex_z.real, ) else: print("incorrect number of arguments: image(z) or image(x, y, z)") return try: o = BookViewer.image(self, *args, **kwargs) except ValueError as x: return o.setvar('complex_z', complex_z) convert_figobj(o) self.add_video_obj(o) return o
def image(self, *args, **kwargs): ''' image(z) or image(x, y, z) ''' if len(args) == 1: z = args[0] x = np.arange(z.shape[-1]) y = np.arange(z.shape[-2]) elif len(args) == 3: x = args[0] y = args[1] z = args[2] if z.ndim != 3: raise ValueError('z data should have ndim = 3') o = BookViewer.image(self, x, y, z[0], **kwargs) if o is None: return convert_figobj(o) o.set_video_data(z) self.add_video_obj(o) return o