I had a similar problem where I wanted to measure the phase and magnitude stability of a system over long periods of time, but only needed small chunks of data to characterize the drift. I solved this by creating a top block that uses the head block and a file sink to write a defined number of samples after doing some other processing. That block was called by a loop like this:
def main(top_block_cls=phase_diff_measure_filechange, options=None): for x in range(0,600): time.sleep(8) tb = top_block_cls() tb.start(1000000) time.sleep(2) tb.stop() tb.wait() The only other trick was to make the file names of the files I was saving contain a time stamp, which was done within def __init__(self): in the variables section like this: self.file_phase = file_phase = path/phase"+datetime.now().strftime("%Y.%m.%d.%H.%M.%S") +".dat" self.file_mag = file_mag = path/mag"+datetime.now().strftime("%Y.%m.%d.%H.%M.%S") +".dat" Those timestamp commands required "import time" There's probably a more elegant way to do this, but it got the job done. Hope that helps, Daniel P. Lundberg, Ph.D. Senior Research Scientist Georgia Tech Research Institute Sensors and Electromagnetic Applications Laboratory Intelligence, Surveillance, & Reconnaissance Division 404.407.7613 daniel.lundb...@gtri.gatech.edu -----Original Message----- From: USRP-users <usrp-users-boun...@lists.ettus.com> On Behalf Of Marcus D. Leech via USRP-users Sent: Monday, April 29, 2019 8:24 PM To: usrp-users@lists.ettus.com Subject: Re: [USRP-users] How to periodically write files using USRP and GNUradio On 04/29/2019 08:08 PM, Mark Wagner via USRP-users wrote: > Hey all, > > I'd like to know how to write short files of streamed USRP data > periodically using GNUradio. For instance, I'd like the USRP to > automatically record 5 seconds of data every 10 minutes. It does not > matter to me whether the USRP is constantly on and most of the data is > being discarded, or if the USRP wakes up every 10 minutes to record > the data before sleeping. Whichever is easiest to achieve is fine by > me. Does anyone have experience doing this kind of thing? > > -Mark > > > > -- > Mark Wagner > University of California San Diego > Electrical and Computer Engineering > > If you're using Gnu Radio, you can simply use the file sink, and have it record to "/dev/null" most of the time, then have something (perhaps via the XMLRPC built-in feature) change the filename to whatever your desired filename is, and then revert it back to "/dev/null". I think I said the same thing on the discuss-gnuradio mailing list a few days ago. The usrp-users mailing list isn't the best place to ask Gnu Radio questions, a question like this, which is inherently radio-type agnostic, probably belongs on the discuss-gnuradio mailng list, because it's more about "how do I make Gnu Radio dance". _______________________________________________ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com _______________________________________________ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com