def _set_memory_segments(self, num_segments, num_samples): """Set up memory segments in the device. For multiple captures, the device's memory must be divided into segments, one for each capture. If the memory cannot contain the required number of samples per segment, an InvalidParameterError is raised. :param num_segments: the number of memory segments. :param num_samples: the number of required samples per capture. """ max_samples = ctypes.c_int32() assert_pico_ok( ps.ps3000aMemorySegments(self._handle, num_segments, ctypes.byref(max_samples))) max_samples = max_samples.value if max_samples < num_samples: raise InvalidParameterError( f"A memory segment can only fit {max_samples}, but " f"{num_samples} are required.")
returnedMaxSamples = ctypes.c_int16() status["GetTimebase"] = ps.ps3000aGetTimebase2( chandle, timebase, maxsamples, ctypes.byref(timeIntervalns), 1, ctypes.byref(returnedMaxSamples), 0) assert_pico_ok(status["GetTimebase"]) # Creates a overlow location for data overflow = ctypes.c_int16() # Creates converted types maxsamples cmaxSamples = ctypes.c_int32(maxsamples) # Handle = Chandle # nSegments = 10 # nMaxSamples = ctypes.byref(cmaxSamples) status["MemorySegments"] = ps.ps3000aMemorySegments(chandle, 10, ctypes.byref(cmaxSamples)) assert_pico_ok(status["MemorySegments"]) # sets number of captures status["SetNoOfCaptures"] = ps.ps3000aSetNoOfCaptures(chandle, 10) assert_pico_ok(status["SetNoOfCaptures"]) # Starts the block capture # Handle = chandle # Number of prTriggerSamples # Number of postTriggerSamples # Timebase = 2 = 4ns (see Programmer's guide for more information on timebases) # time indisposed ms = None (This is not needed within the example) # Segment index = 0 # LpRead = None # pParameter = None