Loading ...
Sorry, an error occurred while loading the content.

1494RE: [SpectrumLabUsers] Re: applying ( Spectrum Lab web server Fftlog1.txt data processing php JS

Expand Messages
  • Mark McCarron
    May 1, 2013
    • 0 Attachment
      Wolf,

      You can use an JSON Array.

      http://www.w3resource.com/JSON/structures.php

      The format is [Value1, Value2, Value3...etc], or in your case [I,Q,I,Q...etc].  No need for key/value pairs.

      It is also possible to read it as a stream:

      http://stackoverflow.com/questions/444380/is-there-a-streaming-api-for-json

      Regards,

      Mark McCarron


      To: SpectrumLabUsers@yahoogroups.com
      From: dl4yhf@...
      Date: Wed, 1 May 2013 08:52:09 +0200
      Subject: Re: [SpectrumLabUsers] Re: applying ( Spectrum Lab web server Fftlog1.txt data processing php JS

       
      Greetings all,

      Javascript / JSON experts out there ?

      How would you format the data for a *complex* FFT, i.e. two components
      per frequency bin, in a JSON response with the minimum possible
      overhead, when its impossible to have different data type *definitions*
      and the data itself ? (this is one of the things I always missed in
      Javascript... I first want to *declare* a data type (struct in "C" or
      record in Pascal) before using it, but in j.s. / JSON they embed the
      names of the struct (or array) members in the response with the data
      themselves.
      Which is very very unfortunate if you have an array of say 524288
      complex frequency bins, and have to put the NAMES of each component in
      each frequency bin because you cannot declare data types in advance ?
      For example, in "C" (not C++) one would first declare a complex number
      as a struct like this

      typedef struct
      { float re;
      float im;
      } T_Complex;

      and then use it in an array of complex numbers like this:

      T_Complex fft[524288] = { {0.1, 0.2}, {0.1, 0.3}, {0.1, 0.4}, ..... };

      ( the receiver of such a line would of course need to know what
      T_Complex is; since it's unnecessary to pass that in the server response)

      How to form such two-dimensional arrays in JSON, without having to put
      the name of each component in each array element (which would be an
      awful waste of memory / network bandwidth) ?

      Or drop JSON (to read FFTs from SL via its HTTP server) and use a simple
      but flexible, self-defined format instead, which can be parsed in any
      programming language ?

      All the best,
      Wolf .


    • Show all 15 messages in this topic