Seti@Home optimized science apps and information

Optimized Seti@Home apps => Discussion Forum => Topic started by: Kavanagh on 14 May 2009, 09:32:52 am

Title: Code documentation - newby question
Post by: Kavanagh on 14 May 2009, 09:32:52 am
Hello all,
I am attempting to write a program that analyses S@H work units. After one hour on the S@H site I am unable to find the documentation on binary data representation. I would be much obliged for a URL.
Richard Kavanagh
Title: Re: Code documentation - newby question
Post by: Raistmer on 14 May 2009, 09:39:33 am
If you willfind such document it woud be great.
th simplest way if not -to read the source in part where it loads workunit  structures into memoy. Some comments about fields loaded could help too.
Title: Re: Code documentation - newby question
Post by: Kavanagh on 14 May 2009, 02:09:31 pm
I am stymied by the following in s_util.cpp

// see the doc on binary data representation

void bits_to_floats(unsigned char* raw, sah_complex* data, int nsamples) {
  int i, j, k=0;
  unsigned char c;

  for (i=0; i<nsamples/4; i++) {
    j = (i&1) ? i-1 : i+1;
    c = raw[j];
    for (j=0; j<4; j++) {
      data[k][0] = (float)((c&2)?1:-1);
      data[k][1] = (float)((c&1)?1:-1);
      k++;
      c >>= 2;
    }
  }
}

I cannot find the binary data representation document and cannot find the definition of  sah_complex. Any pointers?
Richard

Title: Re: Code documentation - newby question
Post by: Jason G on 14 May 2009, 02:14:30 pm
If you follow the definitions, using visual studio's built in 'go to definition' feature, you should find that 'sah_complex' is defined in 's_util.h' as:

typedef float sah_complex[2];

the first float being the real part of a complex single precision value, and the second float being the imaginary part.  This is standard arrangement for a single precision complex numerical value.

The splitter bits to float functionality, is derived directly from radio techniques using some quadrature encoding technique beyond my skill base (otherwise known as 'black magic').  I would not be surprised, though, if Arecibo and Berkeley's methods used in those mechanisms were unique in their encoding schemes, given the age of the installation, and the numerous upgrades & refinements over the years.
Title: Re: Code documentation - newby question
Post by: Kavanagh on 15 May 2009, 04:29:37 am
If you follow the definitions, using visual studio's built in 'go to definition' feature, you should find that 'sah_complex' is defined in 's_util.h' as:

typedef float sah_complex[2];


You unobservant eejit Kavanagh. >:(  I should have been able to infer that from the code anyway.

Thank you Jason.

Richard