File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -869,22 +869,28 @@ def _set_ylim(self, ch_range: RANGE | range_literal) -> None:
869869 min_ylim = - max_ylim
870870 self .ylim = (min_ylim , max_ylim )
871871
872- def get_ylim (self ) -> tuple [float , float ]:
872+ def get_ylim (self , unit : Literal [ 'mv' , 'v' ] = 'mv' ) -> tuple [float , float ]:
873873 """
874874 Returns the ylim of the widest channel range as a tuple.
875- Ideal for pyplot
875+ Ideal for pyplot ylim function.
876+
877+ Args:
878+ unit (str): 'mv' or 'v'. Depending on whether your data is in mV
879+ or Volts.
876880
877881 Returns:
878- tuple[float, float]: _description_
882+ tuple[float, float]: Minium and maximum range values
879883
880884 Examples:
881885 >>> from matplotlib import pyplot as plt
882886 >>> ...
883887 >>> plt.ylim(scope.get_ylim())
884- or
885- >>> plt.ylim(scope.ylim)
886888 """
887- return self .ylim
889+ unit = unit .lower ()
890+ if unit .lower () == 'mv' :
891+ return self .ylim
892+ elif unit .lower ():
893+ return self .ylim [0 ] / 1000 , self .ylim [1 ] / 1000
888894
889895 def set_device_resolution (self , resolution : RESOLUTION ) -> None :
890896 """Configure the ADC resolution using ``ps6000aSetDeviceResolution``.
You can’t perform that action at this time.
0 commit comments