gnuradio.blocks: File Operators

gnuradio.blocks.file_descriptor_sink(size_t itemsize, int fd) → file_descriptor_sink_sptr

Write stream to file descriptor.

Constructor Specific Documentation:

Build a file descriptor sink block.

Parameters:
  • itemsize – item size of the incoming data stream.
  • fd – file descriptor (as an integer).
file_descriptor_sink_sptr.active_thread_priority(file_descriptor_sink_sptr self) → int
file_descriptor_sink_sptr.declare_sample_delay(file_descriptor_sink_sptr self, int which, int delay)

declare_sample_delay(file_descriptor_sink_sptr self, unsigned int delay)

file_descriptor_sink_sptr.message_subscribers(file_descriptor_sink_sptr self, swig_int_ptr which_port) → swig_int_ptr
file_descriptor_sink_sptr.min_noutput_items(file_descriptor_sink_sptr self) → int
file_descriptor_sink_sptr.pc_input_buffers_full_avg(file_descriptor_sink_sptr self, int which) → float

pc_input_buffers_full_avg(file_descriptor_sink_sptr self) -> pmt_vector_float

file_descriptor_sink_sptr.pc_noutput_items_avg(file_descriptor_sink_sptr self) → float
file_descriptor_sink_sptr.pc_nproduced_avg(file_descriptor_sink_sptr self) → float
file_descriptor_sink_sptr.pc_output_buffers_full_avg(file_descriptor_sink_sptr self, int which) → float

pc_output_buffers_full_avg(file_descriptor_sink_sptr self) -> pmt_vector_float

file_descriptor_sink_sptr.pc_work_time_avg(file_descriptor_sink_sptr self) → float
file_descriptor_sink_sptr.pc_work_time_total(file_descriptor_sink_sptr self) → float
file_descriptor_sink_sptr.sample_delay(file_descriptor_sink_sptr self, int which) → unsigned int
file_descriptor_sink_sptr.set_min_noutput_items(file_descriptor_sink_sptr self, int m)
file_descriptor_sink_sptr.set_thread_priority(file_descriptor_sink_sptr self, int priority) → int
file_descriptor_sink_sptr.thread_priority(file_descriptor_sink_sptr self) → int
gnuradio.blocks.file_descriptor_source(size_t itemsize, int fd, bool repeat=False) → file_descriptor_source_sptr

Read stream from file descriptor.

Constructor Specific Documentation:

Build a file descriptor source block.

Parameters:
  • itemsize – item size of the incoming data stream.
  • fd – file descriptor (as an integer).
  • repeat – repeat the data stream continuously.
file_descriptor_source_sptr.active_thread_priority(file_descriptor_source_sptr self) → int
file_descriptor_source_sptr.declare_sample_delay(file_descriptor_source_sptr self, int which, int delay)

declare_sample_delay(file_descriptor_source_sptr self, unsigned int delay)

file_descriptor_source_sptr.message_subscribers(file_descriptor_source_sptr self, swig_int_ptr which_port) → swig_int_ptr
file_descriptor_source_sptr.min_noutput_items(file_descriptor_source_sptr self) → int
file_descriptor_source_sptr.pc_input_buffers_full_avg(file_descriptor_source_sptr self, int which) → float

pc_input_buffers_full_avg(file_descriptor_source_sptr self) -> pmt_vector_float

file_descriptor_source_sptr.pc_noutput_items_avg(file_descriptor_source_sptr self) → float
file_descriptor_source_sptr.pc_nproduced_avg(file_descriptor_source_sptr self) → float
file_descriptor_source_sptr.pc_output_buffers_full_avg(file_descriptor_source_sptr self, int which) → float

pc_output_buffers_full_avg(file_descriptor_source_sptr self) -> pmt_vector_float

file_descriptor_source_sptr.pc_work_time_avg(file_descriptor_source_sptr self) → float
file_descriptor_source_sptr.pc_work_time_total(file_descriptor_source_sptr self) → float
file_descriptor_source_sptr.sample_delay(file_descriptor_source_sptr self, int which) → unsigned int
file_descriptor_source_sptr.set_min_noutput_items(file_descriptor_source_sptr self, int m)
file_descriptor_source_sptr.set_thread_priority(file_descriptor_source_sptr self, int priority) → int
file_descriptor_source_sptr.thread_priority(file_descriptor_source_sptr self) → int
gnuradio.blocks.file_meta_sink(size_t itemsize, std::string const & filename, double samp_rate=1, double relative_rate=1, gr::blocks::gr_file_types type=GR_FILE_FLOAT, bool complex=True, size_t max_segment_size=1000000, std::string const & extra_dict="", bool detached_header=False) → file_meta_sink_sptr

Write stream to file with meta-data headers.

These files represent data as binary information in between meta-data headers. The headers contain information about the type of data and properties of the data in the next segment of samples. The information includes:

Tags can be sent to the file to update the information, which will create a new header. Headers are found by searching from the first header (at position 0 in the file) and reading where the data segment starts plus the data segment size. Following will either be a new header or EOF.

Constructor Specific Documentation:

Create a meta-data file sink.

Parameters:
  • itemsize – (size_t): Size of data type.
  • filename – (string): Name of file to write data to.
  • samp_rate – (double): Sample rate of data. If sample rate will be set by a tag, such as rx_tag from a UHD source, this is basically ignored.
  • relative_rate – (double): Rate chance from source of sample rate tag to sink.
  • type – (gr_file_types): Data type (int, float, etc.)
  • complex – (bool): If data stream is complex
  • max_segment_size – (size_t): Length of a single segment before the header is repeated (in items).
  • extra_dict – (string): a serialized PMT dictionary of extra information. Currently not supported.
  • detached_header – (bool): Set to true to store the header info in a separate file (named filename.hdr)
file_meta_sink_sptr.active_thread_priority(file_meta_sink_sptr self) → int
file_meta_sink_sptr.close(file_meta_sink_sptr self)
file_meta_sink_sptr.declare_sample_delay(file_meta_sink_sptr self, int which, int delay)

declare_sample_delay(file_meta_sink_sptr self, unsigned int delay)

file_meta_sink_sptr.do_update(file_meta_sink_sptr self)
file_meta_sink_sptr.message_subscribers(file_meta_sink_sptr self, swig_int_ptr which_port) → swig_int_ptr
file_meta_sink_sptr.min_noutput_items(file_meta_sink_sptr self) → int
file_meta_sink_sptr.open(file_meta_sink_sptr self, std::string const & filename) → bool
file_meta_sink_sptr.pc_input_buffers_full_avg(file_meta_sink_sptr self, int which) → float

pc_input_buffers_full_avg(file_meta_sink_sptr self) -> pmt_vector_float

file_meta_sink_sptr.pc_noutput_items_avg(file_meta_sink_sptr self) → float
file_meta_sink_sptr.pc_nproduced_avg(file_meta_sink_sptr self) → float
file_meta_sink_sptr.pc_output_buffers_full_avg(file_meta_sink_sptr self, int which) → float

pc_output_buffers_full_avg(file_meta_sink_sptr self) -> pmt_vector_float

file_meta_sink_sptr.pc_work_time_avg(file_meta_sink_sptr self) → float
file_meta_sink_sptr.pc_work_time_total(file_meta_sink_sptr self) → float
file_meta_sink_sptr.sample_delay(file_meta_sink_sptr self, int which) → unsigned int
file_meta_sink_sptr.set_min_noutput_items(file_meta_sink_sptr self, int m)
file_meta_sink_sptr.set_thread_priority(file_meta_sink_sptr self, int priority) → int
file_meta_sink_sptr.set_unbuffered(file_meta_sink_sptr self, bool unbuffered)
file_meta_sink_sptr.thread_priority(file_meta_sink_sptr self) → int
gnuradio.blocks.file_meta_source(std::string const & filename, bool repeat=False, bool detached_header=False, std::string const & hdr_filename="") → file_meta_source_sptr

Reads stream from file with meta-data headers. Headers are parsed into tags.

The information in the metadata headers includes:

Any item inside of the extra header dictionary is ready out and made into a stream tag.

Constructor Specific Documentation:

Create a meta-data file source.

Parameters:
  • filename – (string): Name of file to write data to.
  • repeat – (bool): Repeats file when EOF is found.
  • detached_header – (bool): Set to true if header info is stored in a separate file (usually named filename.hdr)
  • hdr_filename – (string): Name of detached header file if used. Defaults to ‘filename.hdr’ if detached_header is true but this field is an empty string.
file_meta_source_sptr.active_thread_priority(file_meta_source_sptr self) → int
file_meta_source_sptr.close(file_meta_source_sptr self)
file_meta_source_sptr.declare_sample_delay(file_meta_source_sptr self, int which, int delay)

declare_sample_delay(file_meta_source_sptr self, unsigned int delay)

file_meta_source_sptr.do_update(file_meta_source_sptr self)
file_meta_source_sptr.message_subscribers(file_meta_source_sptr self, swig_int_ptr which_port) → swig_int_ptr
file_meta_source_sptr.min_noutput_items(file_meta_source_sptr self) → int
file_meta_source_sptr.open(file_meta_source_sptr self, std::string const & filename, std::string const & hdr_filename="") → bool
file_meta_source_sptr.pc_input_buffers_full_avg(file_meta_source_sptr self, int which) → float

pc_input_buffers_full_avg(file_meta_source_sptr self) -> pmt_vector_float

file_meta_source_sptr.pc_noutput_items_avg(file_meta_source_sptr self) → float
file_meta_source_sptr.pc_nproduced_avg(file_meta_source_sptr self) → float
file_meta_source_sptr.pc_output_buffers_full_avg(file_meta_source_sptr self, int which) → float

pc_output_buffers_full_avg(file_meta_source_sptr self) -> pmt_vector_float

file_meta_source_sptr.pc_work_time_avg(file_meta_source_sptr self) → float
file_meta_source_sptr.pc_work_time_total(file_meta_source_sptr self) → float
file_meta_source_sptr.sample_delay(file_meta_source_sptr self, int which) → unsigned int
file_meta_source_sptr.set_min_noutput_items(file_meta_source_sptr self, int m)
file_meta_source_sptr.set_thread_priority(file_meta_source_sptr self, int priority) → int
file_meta_source_sptr.thread_priority(file_meta_source_sptr self) → int
gnuradio.blocks.file_sink(size_t itemsize, char const * filename, bool append=False) → file_sink_sptr

Write stream to file.

Constructor Specific Documentation:

Make a file sink.

Parameters:
  • itemsize – size of the input data items.
  • filename – name of the file to open and write output to.
  • append – if true, data is appended to the file instead of overwriting the initial content.
file_sink_sptr.active_thread_priority(file_sink_sptr self) → int
file_sink_sptr.close(file_sink_sptr self)

Close current output file.

Closes current output file and ignores any output until open is called to connect to another file.

file_sink_sptr.declare_sample_delay(file_sink_sptr self, int which, int delay)

declare_sample_delay(file_sink_sptr self, unsigned int delay)

file_sink_sptr.do_update(file_sink_sptr self)

if we’ve had an update, do it now.

file_sink_sptr.message_subscribers(file_sink_sptr self, swig_int_ptr which_port) → swig_int_ptr
file_sink_sptr.min_noutput_items(file_sink_sptr self) → int
file_sink_sptr.open(file_sink_sptr self, char const * filename) → bool

Open filename and begin output to it.

file_sink_sptr.pc_input_buffers_full_avg(file_sink_sptr self, int which) → float

pc_input_buffers_full_avg(file_sink_sptr self) -> pmt_vector_float

file_sink_sptr.pc_noutput_items_avg(file_sink_sptr self) → float
file_sink_sptr.pc_nproduced_avg(file_sink_sptr self) → float
file_sink_sptr.pc_output_buffers_full_avg(file_sink_sptr self, int which) → float

pc_output_buffers_full_avg(file_sink_sptr self) -> pmt_vector_float

file_sink_sptr.pc_work_time_avg(file_sink_sptr self) → float
file_sink_sptr.pc_work_time_total(file_sink_sptr self) → float
file_sink_sptr.sample_delay(file_sink_sptr self, int which) → unsigned int
file_sink_sptr.set_min_noutput_items(file_sink_sptr self, int m)
file_sink_sptr.set_thread_priority(file_sink_sptr self, int priority) → int
file_sink_sptr.set_unbuffered(file_sink_sptr self, bool unbuffered)

turn on unbuffered writes for slower outputs

file_sink_sptr.thread_priority(file_sink_sptr self) → int
gnuradio.blocks.file_source(size_t itemsize, char const * filename, bool repeat=False) → file_source_sptr

Read stream from file.

Constructor Specific Documentation:

Create a file source.

Opens as a source of items into a flowgraph. The data is expected to be in binary format, item after item. The of the block determines the conversion from bits to items.

If is turned on, the file will repeat the file after it’s reached the end.

Parameters:
  • itemsize – the size of each item in the file, in bytes
  • filename – name of the file to source from
  • repeat – repeat file from start
file_source_sptr.active_thread_priority(file_source_sptr self) → int
file_source_sptr.close(file_source_sptr self)

Close the file handle.

file_source_sptr.declare_sample_delay(file_source_sptr self, int which, int delay)

declare_sample_delay(file_source_sptr self, unsigned int delay)

file_source_sptr.message_subscribers(file_source_sptr self, swig_int_ptr which_port) → swig_int_ptr
file_source_sptr.min_noutput_items(file_source_sptr self) → int
file_source_sptr.open(file_source_sptr self, char const * filename, bool repeat)

Opens a new file.

file_source_sptr.pc_input_buffers_full_avg(file_source_sptr self, int which) → float

pc_input_buffers_full_avg(file_source_sptr self) -> pmt_vector_float

file_source_sptr.pc_noutput_items_avg(file_source_sptr self) → float
file_source_sptr.pc_nproduced_avg(file_source_sptr self) → float
file_source_sptr.pc_output_buffers_full_avg(file_source_sptr self, int which) → float

pc_output_buffers_full_avg(file_source_sptr self) -> pmt_vector_float

file_source_sptr.pc_work_time_avg(file_source_sptr self) → float
file_source_sptr.pc_work_time_total(file_source_sptr self) → float
file_source_sptr.sample_delay(file_source_sptr self, int which) → unsigned int
file_source_sptr.seek(file_source_sptr self, long seek_point, int whence) → bool

seek file to relative to

file_source_sptr.set_min_noutput_items(file_source_sptr self, int m)
file_source_sptr.set_thread_priority(file_source_sptr self, int priority) → int
file_source_sptr.thread_priority(file_source_sptr self) → int
gnuradio.blocks.tagged_file_sink(size_t itemsize, double samp_rate) → tagged_file_sink_sptr

A file sink that uses tags to save files.

The sink uses a tag with the key ‘burst’ to trigger the saving of the burst data to a new file. If the value of this tag is True, it will open a new file and start writing all incoming data to it. If the tag is False, it will close the file (if already opened). The file names are based on the time when the burst tag was seen. If there is an ‘rx_time’ tag (standard with UHD sources), that is used as the time. If no ‘rx_time’ tag is found, the new time is calculated based off the sample rate of the block.

Constructor Specific Documentation:

Build a tagged_file_sink block.

Parameters:
  • itemsize – The item size of the input data stream.
  • samp_rate – The sample rate used to determine the time difference between bursts
tagged_file_sink_sptr.active_thread_priority(tagged_file_sink_sptr self) → int
tagged_file_sink_sptr.declare_sample_delay(tagged_file_sink_sptr self, int which, int delay)

declare_sample_delay(tagged_file_sink_sptr self, unsigned int delay)

tagged_file_sink_sptr.message_subscribers(tagged_file_sink_sptr self, swig_int_ptr which_port) → swig_int_ptr
tagged_file_sink_sptr.min_noutput_items(tagged_file_sink_sptr self) → int
tagged_file_sink_sptr.pc_input_buffers_full_avg(tagged_file_sink_sptr self, int which) → float

pc_input_buffers_full_avg(tagged_file_sink_sptr self) -> pmt_vector_float

tagged_file_sink_sptr.pc_noutput_items_avg(tagged_file_sink_sptr self) → float
tagged_file_sink_sptr.pc_nproduced_avg(tagged_file_sink_sptr self) → float
tagged_file_sink_sptr.pc_output_buffers_full_avg(tagged_file_sink_sptr self, int which) → float

pc_output_buffers_full_avg(tagged_file_sink_sptr self) -> pmt_vector_float

tagged_file_sink_sptr.pc_work_time_avg(tagged_file_sink_sptr self) → float
tagged_file_sink_sptr.pc_work_time_total(tagged_file_sink_sptr self) → float
tagged_file_sink_sptr.sample_delay(tagged_file_sink_sptr self, int which) → unsigned int
tagged_file_sink_sptr.set_min_noutput_items(tagged_file_sink_sptr self, int m)
tagged_file_sink_sptr.set_thread_priority(tagged_file_sink_sptr self, int priority) → int
tagged_file_sink_sptr.thread_priority(tagged_file_sink_sptr self) → int

Previous topic

gnuradio.blocks: Data Type Converters

Next topic

gnuradio.blocks: Message Tools

This Page