Closed damercer closed 6 years ago
Hi, It should work. I made a python program which changes the sample rate, then reads data for a second and then prints the number of samples read. It works as expected.
I attached the program here.
Thanks
I must be doing something wrong then. When I connect an external sine wave source (M2k and Scopy) at 500 Hz I get too many samples per cycle of the sine wave. If I set the sample rate to 50,000 I should get 100 samples between peaks of the sine wave. In the raw data I'm getting 200 samples between peaks which says to me that the sample rate is actually still 100 KSPS?
Here is a csv file of the raw samples. Channel A V contains the 500 Hz signal from M2k/Scopy.
Thanks for checking this out.
Doug
Here is some other results of testing: Subroutine I use to create session:
#
def ConnectDevice():
global devx, dev0, dev1, dev2, session, BrdSel, CHA, CHB, DevID, MaxSamples, AWGSAMPLErate
global bcon, FWRevOne, HWRevOne, FWRevTwo, HWRevTwo, WRevThree, HWRevThree, SAMPLErate
if DevID == "No Device" or DevID == "m1k":
SAMPLErate = AWGSAMPLErate # Scope sample rate
print("Request sample rate: " + str(SAMPLErate))
session = Session(ignore_dataflow=True, sample_rate=SAMPLErate, queue_size=MaxSamples)
# session.add_all()
if not session.devices:
print 'No Device plugged IN!'
DevID = "No Device"
bcon.configure(text="Recon", style="RConn.TButton") #, bg="red")
return
session.configure()
print("Session sample rate: " + str(session.sample_rate))
MakeBoardScreen()
SelectBoard()
bcon.configure(text="Conn", style="GConn.TButton")
#
This is what gets printed in the console screen:
Request sample rate: 50000 Session sample rate: 100000
session still seems to be at 100KSPS???
Doug
The problem is that after you create the session, the sample rate is set to 50000 and after that you call session.configure() (configure method is used to set the session sample rate) and the implicit value of that parameter is 0 (which means use the default sample rate 100kSps). If you remove the line with session.configure() it should work.
OK This is what's happening. When I run the session.configure() it resets the sample rate to 100KSPS. If I comment out this line it stays as set in the session initialization. Do I need to pass something to the session.configure() call? Things seem to work without this but I will need to completely retest all the operations of the program again to be sure.
Doug
Session.configure() sets the session sample rate, and it takes one parameter, the sample rate that you want for the session. If you don't pass any parameter the session will be configured to run at 100KSPS.
Hello: In Libsmu 1.0 Python bindings there is an optional parameter shown in the source code:
to change the sample rate.
I use the following line to initialize a session: session = Session(ignore_dataflow=True, sample_rate=SAMPLErate, queue_size=MaxSamples) Where SAMPLErate is an integer. This does not seem to actually change/set the sample rate to the value passed. Seems to use default 100 KHz. I tried 75000 and the actual rate remained 100000.
Is this supposed to work or does it also need something different in the firmware to change as well? If not this should be noted in the source code documentation in the mean time.
Thanks Doug