Kubke Lab:Research/ABR/Notebook/2013/11/05: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
Line 25: Line 25:
read next 1000 points,  
read next 1000 points,  
and so on
and so on
<pre>
rawData = file("189L0A.ABR", "rb")
a <- readBin(rawData,integer(),file.info("189L0A.ABR")$size,size = 2)
#size2 says integer is 2 bytes
close(rawData)
plot(a)
plot(a, ylim = c(-500,500))
#at the begining there is 564points that correspond to the header
#If I clean up the header
plot(a[562:2565], type="line")
str(a)
b<-seq(1,length(a), 2)
c<-seq(2,length(a),2)
plot(a[b])
plot(a[c])
aclean<-a[562:2565]
   
head(aclean)
head(aclean[b])
head(aclean[c])
plot(aclean[b], xlim=c(0,1000))
plot(aclean[c], xlim=c(0,1000))
</pre>


==Andy==
==Andy==

Revision as of 01:33, 5 November 2013

Hearing development in barn owls <html><img src="/images/9/94/Report.png" border="0" /></html> Main project page
<html><img src="/images/c/c3/Resultset_previous.png" border="0" /></html>Previous entry<html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html>Next entry<html><img src="/images/5/5c/Resultset_next.png" border="0" /></html>


General Entries

  • Insert content here.

Personal Entries

Fabiana

  • trying to open the actual .ABR files - getting nowhere. Noticed the log files that were extracted dont have the info I need and need to see what info is in the actual data files.

Andy says it is an intel file - over skype trying to figure out the structure so we can read it - extracting info from abr.h and abr_4_mac.c

According to andy need to Read the first 1128 bytes then read the next 1000 2-byte int skip 52 read next 1000 points, and so on

rawData = file("189L0A.ABR", "rb")
a <- readBin(rawData,integer(),file.info("189L0A.ABR")$size,size = 2) 
#size2 says integer is 2 bytes
close(rawData)
plot(a) 
plot(a, ylim = c(-500,500))
#at the begining there is 564points that correspond to the header
#If I clean up the header 
plot(a[562:2565], type="line")
str(a)
b<-seq(1,length(a), 2)
c<-seq(2,length(a),2)
plot(a[b]) 
plot(a[c])
aclean<-a[562:2565]
     
head(aclean)
head(aclean[b])
head(aclean[c])
plot(aclean[b], xlim=c(0,1000))
plot(aclean[c], xlim=c(0,1000))


Andy

Following file is from the ABR.H header file that was used for the original files.

File layout is probably: <Master_Header><Sub_Structure><1000 2-byte INT><Sub_Structure><1000 2-byte INT> ...

This structure needs to be confirmed.



typedef struct

   {
   short freq;	/* frequency in Hz */
   short amp;	/* amplitude in D/A units */
   short dur;		/* duration in clock ticks */
   short rise_fall;	/* rise_fall in clock ticks */
   } SIGNAL; // 8 bytes

typedef struct

   {
   SIGNAL carrier;
   SIGNAL envelope;
   } STIMULUS;

typedef struct

   {
   short left_delay;	/* microseconds to left  onset */
   short right_delay;	/* microseconds to right onset */
   short rep_shorterval;	/* interval in millseconds */
   } TIMING; //6 bytes

typedef struct

   {
   short clock;	    /* clock frequency in kHz */
   short max_size;   /* maximum size of each array */
   short channels;   /* 1 for carrier only, 2 for carrier & envelope */
   } DA_INFO; //6 bytes

typedef struct

   {
   short clock;	    /* in kHz */
   short size;	    /* number of elements (per channel) */
   short channels;   /* number of channels */
   short avg_reps;   /* number of reps making up the average */
   } AD_INFO; //8 bytes

typedef struct

   {
   char date[12];
   char time[12];
   char owl_id[12];
   char exp_id[12];
   char comments[80];
   short depth;
   short version;
   char side;
   short num_chan;
   short num_tests;
   short gain;
   char extra_room[1024-(12+12+12+12+80+2+2+1+2+2+2)];/* Add two more to correct CHAR */
   //    char extra_room[1024-(12+12+12+12+80+2+2+1)];/* Add two more to correct CHAR */
   } HEADER_INFO,  EXPERIMENT_HEADER; // Bytes 1024

typedef struct /**** THE MASTER STRUCTURE ****/

   {
   HEADER_INFO header; //1024
   STIMULUS left;      //  16
   STIMULUS right;     //  16
   TIMING delay;       //   6
   DA_INFO output;     //   6
   AD_INFO input;      //   8
   } EXPERIMENT;   // 1076 bytes


typedef struct /**** SUB STRUCTURE ****/

   {
   STIMULUS left;      //    16
   STIMULUS right;     //    16
   TIMING delay;       //     6
   DA_INFO output;     //     6
   AD_INFO input;      //     8
   } EXPERIMENT_INFO; // 52 bytes

Oris

  • Enter content here