MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Reed-Solomon_Encoder",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "5397": {
                "pageid": 5397,
                "ns": 0,
                "title": "Reading Binary Files",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "\nThis tutorial describes how to read binary files using the '''File Source''' block along side how to diagnose potential errors.\n\nPlease review the [[Writing_Binary_Files|Writing Binary Files]] tutorial before continuing. A series of binary files were created with different formats that will be needed for this tutorial:\n\n[[File:Reading_binary_files_all_formats.png]]\n\n\n==File Source Block==\nThe '''File Source''' block reads from a binary file and then sends the samples to the output port. Drag the '''File Source''' block into a flowgraph. The block by default uses the complex data type (32-bit floats), represented by the '''<span style=\"color:blue\">blue</span>''' output port:\n\n[[File:Reading_binary_files_add_file_sink_block.png]]\n\n\nDouble clicking the '''File Source''' block brings up the properties and the ability to select different data types.\n\n[[File:Reading_binary_files_file_source_data_types.png]]\n\n\nA binary file of real floating point data requires the float data type to be selected, which outputs real floating point samples, denoted by an '''<span style=\"color:orange\">orange</span>''' output port.\n\n[[File:Reading_binary_files_file_sink_real_float.png]]\n\n\nA binary file of 16-bit signed integers requires the short data type to be selected, which outputs 16-bit integers of either real or interleaved I and Q samples (more on this later in the tutorial), denoted by a '''<span style=\"color:yellow\">yellow</span>''' output port.\n\n[[File:Reading_binary_files_file_sink_real_short.png]]\n\n\nAlso note that the '''File Source''' has the ''Repeat'' field enabled as ''Yes'', which will continually and repeatedly play back the same file. Once the last sample is received in the file it skips back to the first sample in the file and continues cycling through the file.\n\n[[File:Reading_binary_files_repeat_yes.png]]\n\n\n==Reading Complex Float==\nAdd a '''File Source''' block, open the properties and begin by selecting the complex type.\n\n[[File:Reading_binary_files_add_complex_float_file_source.png]]\n\n\nClick the three dots to the right side of the File property to browse to a stored binary file.\n\n[[File:Reading_binary_files_open_file.png]]\n\n\nSelect the file ending in ''.complex_float'':\n\n\n[[File:Reading_binary_files_select_complex_float.png]]\n\n\nThe '''File Source''' block will now populate the filename:\n\n[[File:Reading_binary_files_complex_float_with_filename.png]]\n\n\nNotice that the filename is now filled in for the '''File Source''' however the ''samp_rate'' variable is incorrectly 32 kHz (32,000). The sampling rate from the filename is 100 kHz (100,000) therefore update the ''samp_rate'' variable:\n\n[[File:Reading_binary_files_update_samp_rate.png]]\n\n\nThe change will be reflected in the flowgraph:\n\n[[File:Reading_binary_file_update_samp_rate_flowgraph.png]]\n\n\nAdd in the '''QT GUI Time Sink''' and '''QT GUI Frequency Sink''' and connect them accordingly. Notice how both blocks use ''samp_rate'' variable automatically:\n\n[[File:Reading_binary_files_add_time_freq_sink.png]]\n\n\nBefore running the flowgraph, recall that the [[Writing_Binary_Files|Writing Binary Files]] generated a 1 kHz complex sinusoid at a sampling rate of 100 kHz. When playing the file using the '''File Source''' the same waveform should be seen.\n\n[[File:Reading_binary_files_signal_source.png]]\n\n\nNow run the flowgraph. Notice that the time-domain plot has sinusoidal shapes on the I and Q channels, characteristic of a complex sinusoid. Also notice how the frequency plot displays a tone with a single peak, also characteristic of a complex sinusoid. Finally, notice how the peak of the frequency plot has a peak of approximately 1 kHz confirming that the binary file was read properly and the ''samp_rate'' variable was set properly.\n\n[[File:Reading_binary_files_time_freq_complex_float_display.png|750px]]\n\n==Reading Real Float==\nTo read from a file storing real samples encoded as floating point numbers, open the '''File Source''' and change the ''Output Type'' to float:\n\n[[File:Reading_binary_files_select_real_float_type.png]]\n\nClick the three dots next to File and select the file ending in ''.real_float'':\n\n\n[[File:Reading_binary_files_select_real_float_file.png]]\n\n\nOpen the '''QT GUI Time Sink''' properties and change the type to ''float'':\n\n[[File:Reading_binary_files_time_sink_real.png]]\n\n\nOpen the '''QT GUI Freq Sink''' properties and change the type to ''float'':\n\n[[File:Reading_binary_files_freq_sink_real.png]]\n\n\nThe flowgraph should now look like the following:\n\n[[File:Reading_binary_files_real_float_flowgraph.png]]\n\n\nRun the flowgraph. Notice that the time-domain plot displays a single sinusoid, characteristic of a real sinusoid waveform. Also notice that the frequency domain plot displays two peaks, characteristic of a real sinusoid. Finally, notice that the peak on the right hand side, the positive frequencies, is at approximately 1 kHz, confirming that the binary file was read properly and the ''samp_rate'' variable is set properly.\n\n[[File:Reading_binary_files_time_freq_real_float_display.png|750px]]\n\n\n==Reading Real Integers==\nBegin by adding a '''File Source''' block. Open the properties and navigate to the file ending in ''.real_int'':\n\n[[File:Reading_binary_files_select_real_int_file.png]]\n\n\nChange the ''Output Type'' property to be ''short''. '''Be sure not to select int''':\n\n[[File:Reading_binary_files_select_real_short_type.png]]\n\n\nAdd in a Short to Float block and connect it accordingly:\n\n[[File:Reading_binary_files_real_int_flowgraph.png]]\n\n\nNotice that the scale factor here is set to 1. This will plot all of the values at full scale, which is from <math>-2^{15}</math> to <math>2^{15}-1</math>, or 32,768 to +32767. Running the flowgraph with a scaling value of 1 is valid, although some flowgraphs may use a scale factor in order to normalize the data to be within -1 to +1. Open the '''Short to Float''' properties and enter a scale factor of 2^15:\n\n[[File:Reading_binary_files_short_to_float_scale_factor.png]]\n\n\nThe '''Short to Float''' block applies the inverse of the scale factor, meaning it will scale the output samples by <math>2^{-15}</math> or 1/32768. The flowgraph will now look like the following:\n\n[[File:Reading_binary_files_real_int_flowgraph_with_scale_factor.png]]\n\n\nRunning the flowgraph displays the file after being read as real integers. The time domain plot displays a single sinusoid which is characteristic of a real sinusoid, and the frequency domain plot displays two tones which is also characteristic of a real sinusoid. Finally, the peak at the positive frequency tone is approximately 1 kHz which confirms that the file is being read correctly.\n\n[[File:Reading_binary_files_time_freq_real_int.png|750px]]\n\n==Reading Complex Integers==\nBegin by adding a '''File Source''' block. Open the properties and navigate to the file ending in ''.complex_int'':\n\n[[File:Reading_binary_files_select_complex_int.png]]\n\n\nOpen the '''File Source''' properties and select the short data type. '''Do not select the int type''':\n\n[[File:Reading_binary_files_select_short_type.png]]\n\n\nDrag in a '''IShort to Complex''' block and connect it accordingly. Convert the '''QT GUI Time Sink''' and '''QT GUI Frequency Sink''' blocks into the ''complex'' data type. The flowgraph should look like the following.\n\n\n[[File:reading_binary_files_complex_int_flowgraph.png]]\n\n\nNote that the '''IShort to Complex''' block has a scale factor of 1, which would plot the data on a range of <math>-2^{15}</math> to <math>2^{15}-1</math>, or -32,768 to +32,767. Running the flowgraph in this state is valid. However, some flowgraphs require normalization such that all values are within -1 and +1. To do so, open the block\u2019s properties and use a scale factor of <math>2^{15}</math>:\n\n[[File:Reading_binary_files_ishort_to_complex_scale_factor.png]]\n\n\nThe '''IShort to Complex''' block will apply the inverse of the scale factor, <math>2^{-15}</math> or 1/32768, producing normalized samples from -1 to +1.\n\n[[File:Reading_binary_files_complex_int_flowgraph_scale_factor.png]]\n\n\nRun the flowgraph. The time domain plot displays two sinusoids, characteristic of a complex sinusoid. The frequency domain plot displays a single tone, also characteristic of a complex sinusoid. Finally, the tone is at approximate 1 kHz which confirms that the file is being read correctly.\n\n[[File:Reading_binary_files_time_freq_complex_int_display.png|750px]]\n\n==Continuous Playback from File==\nThe '''File Source''' block comes with the option to repeat playback from file. When ''Yes'' is selected for repeat, the samples will be played back on loop until the flowgraph is stopped.\n\n[[File:Reading_binary_files_repeat_yes.png]]\n\nWhen ''No'' is selected for repeat, then all of the samples will be read from file and then the flowgraph will stop running once the last sample is read and then processed through the flowgraph.\n\n[[File:Reading_binary_files_repeat_no.png]]\n\n==Diagnosing Errors: Wrong Type and Format==\n\nIn order to properly read a binary file both the type (real or complex) and format (integer or floating point) need to be known. If given a file and the type or format is unknown, it is best to check all possible combinations and to see which is the most reasonable. Endianness (described in the next section) is another potential problem when reading binary files.\n\nThe following are examples of a file being read improperly. Warning: different recordings will present different type and format errors differently, '''the images presented here are not exhaustive''' and are only a couple of examples to help build intuition to diagnose these kinds of errors. \n\nThe following image is an example of a real integer being read as real floats. Note how large the values are in the time domain: on the order of <math>10^{38}</math>! Values that are abnormally small or abnormally large clearly indicate the file is not being read correctly.\n\n[[File:Reading_binary_files_real_int_as_real_float.png|750px]]\n\n\nThe following image is an example of complex floats being read as real floats. This kind of error can be deceptive because both the time domain and frequency domain are reasonable. The time domain has a semi-sinusoidal effect and the frequency domain has a series of peaks. Without knowing the underlying data, it could be reasonable to assume this file is being read correctly. However, it is important to try the different combinations of type and format, and reading the file as complex floats should more clearly reveal the true nature of the file.\n\n[[File:Reading_binary_files_complex_floats_as_real_floats.png|750px]]\n\n\nThe following image shows the result when a complex floats are read as complex integers. Note that the imaginary portion of the time domain in the red represents a very strange shape which is suggestive that the file is being read incorrectly. Similarly, the frequency domain plot does not display a clearly intelligible signal.\n\n[[File:Reading_binary_files_complex_float_as_complex_int.png|750px]]\n\n\nThe following image is a binary file of real integers being read as complex integers. This one is tricky because at first glance it appears to be tricky, but for a complex sinusoid the real and imaginary data should be pi/2 radians out of phase with one another. Also note that the highlighted frequency is 2 kHz, and not 1 kHz as it should be, another indicator that the file was not read correctly. This is an example of why it it is important to try the different combinations of type and format, such that reading the file as complex integers should allow the user to recognize the signal is being read correctly.\n\n[[File:Reading_binary_files_real_int_as_complex_integers.png|750px]]\n\n==Diagnosing Errors: Endianness==\nEndianness describes the ordering of the bits,from most significant bit (MSB) to least significant bit (LSB). Different processing architectures use different endianness and that is another factor effecting how binary files are interpreted. Endianness is only a potential problem when dealing with files from different processing systems, and therefore not an issue when performing playback from a capture taken from the same native system.\n\nThe following image is an example of a complex float file being read using the incorrect endianness:\n\n[[File:Reading_binary_files_complex_float_endianness_display.png|750px]]\n\n\nThe values being abnormally large (10^38) is a clear indicator that the file is being read incorrectly. Add the '''Endian Swap''' block to the flowgraph at the output of the '''File Source''':\n\n[[File:Reading_binary_files_complex_float_endian_flowgraph.png]]\n\n\nRunning the flowgraph now displays the correct result:\n\n[[File:Reading_binary_files_complex_float_endianness_correct_display.png|750px]]\n\n\nThe following image is an example of real integers being read with the incorrect endianness:\n\n[[File:Reading_binary_files_real_int_endianness.png|750px]]\n\n\nThis error can be correct by using the '''Endian Swap block''' and selecting the ''short'' data type and connecting it in the flowgraph after the '''File Source''':\n\n[[File:Reading_binary_files_real_int_endian_swap_flowgraph.png]]\n\n\nRunning the updated flowgraph now displays the correct result:\n\n[[File:Reading_binary_files_real_int_endianness_display_correct.png|750px]]"
                    }
                ]
            },
            "3728": {
                "pageid": 3728,
                "ns": 0,
                "title": "Reed-Solomon Decoder",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "[[Category:Block Docs]]\nReed Solomon decoder.\n\nETSI EN 300 744 Clause 4.3.2 \n\nRS(N=204,K=239,T=8).\n\n== Parameters ==\n\n; p\n: characteristic of GF(p^m).\n\n; m\n: we use GF(p^m).\n\n; GF polynomial\n: Generator Polynomial.\n\n; N\n: length of codeword of RS coder.\n\n; K\n: length of information sequence of RS decoder.\n\n; t\n: number of corrected errors.\n\n; Shortening size\n: shortened length.\n\n; Blocks\n: number of blocks to process at once.\n\n== Example Flowgraph ==\n\nThis flowgraph can be found at [https://github.com/gnuradio/gnuradio/blob/master/gr-dtv/examples/dvbt_rx_8k.grc].\n\n[[File:Dvbt_rx_8k_fg.png|800px]]\n\n== Source Files ==\n\n; C++ files\n: [https://github.com/gnuradio/gnuradio/blob/master/gr-dtv/lib/dvbt/dvbt_reed_solomon_dec_impl.cc]\n\n; Header files\n: [https://github.com/gnuradio/gnuradio/blob/master/gr-dtv/lib/dvbt/dvbt_reed_solomon_dec_impl.h]\n\n; Public header files\n: [https://github.com/gnuradio/gnuradio/blob/master/gr-dtv/include/gnuradio/dtv/dvbt_reed_solomon_dec.h]\n\n; Block definition\n: [https://github.com/gnuradio/gnuradio/blob/master/gr-dtv/grc/dtv_dvbt_reed_solomon_dec.block.yml]"
                    }
                ]
            }
        }
    }
}