pro bsd_struct, bsd_header = bsd_header, bsd_index = bsd_index, $ 
 bsd_roadmap = bsd_roadmap, bsd_data = bsd_data
;+
;	NAME:
;		bsd_struct  V0.9
;	PURPOSE:
;		Define structures for reading/writing BSD files
;
;	CALLING SEQUENCE:
;		bsd_struct
;	HISTORY:
;		Written by John Mariska (23 Oct 91)
;               Checked atp 27-mar-92
;		two new structures added. atp may 92.
;		added statistical error tag to structure data atp may92
;		header documentation atp 7/7/92
;
;       notes: 
;		** in the descriptor field of an entry will 
;                indicate that this entry is not in the file.
;-

bsd_header = {bsd_h, $
	totspc: long(0), $	; 00- Total number of spectra all channels
	numchn: lonarr(4), $	; 04- Number of spectra for each channels
	ptrdmp: lonarr(4), $	; 20- Pointer to arrays pointing to spectra
	floval: long(0), $	; 36- Flag indicating flare offset entered
	floset: fltarr(2), $	; 40- X and Y offsets
	flcorr: long(0), $	; 48- Flag indicating flare offset corrected
	spare1: bytarr(12), $	; 52- Spare should be spaces
	peak: fltarr(4), $	; 00- peak value in spectrum
	pknum: lonarr(4), $	; 16- bin that contains the above
	vernum: long(0), $	; 32- version of this bsd file
	spare2: bytarr(28), $	; 36- Spare should be spaces
	tdf: lonarr(7), $	; 00- Start time in file
	tdl: lonarr(7), $	; 28- End time in file
	spare3: bytarr(8) }	; 56- Spare should be spaces

bsd_index = {bsd_r_h, $
	chan: long(0), $	; 00- Channel number
	tsec79: long(0), $	; 04- Start time s since 1979
	time: lonarr(7), $	; 08- Time hh mm ss ms mm dd yy
	tlapse: float(0), $	; 36- Accumulation time
	crate: float(0), $	; 40- Total count rate per sec
	blisvn: long(0), $	; 44- Bin list version number
	grppln: long(0), $	; 48- Grouper plan
	dtype: long(0), $	; 52- Data type (0=calib, 1=science)
	nbinssp: long(0), $	; 56- No of bins in this channel
	spare1: bytarr(4), $	; 60- Spare should be spaces
	sdgi: float(0), $	; 00- Sum of data gather intervals
	wo: float(0), $		; 04- Wave offset of first bin
	dw: float(0), $		; 08- Wave dispersion angs/bin
	point: fltarr(3), $	; 12- Average pointing p, y, r
	avpoint: float(0), $	; 24- Average pointing offset
	rmsdev: float(0), $	; 28- RMS deviation of offset
	ipcor: long(0), $	; 32- Flag indicates ptng off corr appl
	icvcor: long(0), $	; 36- Flag curvature corr applied
	idcor: long(0), $	; 40- Flag deadtime corr applied
	iwcor: long(0), $	; 44- Flag wave disp off corrected
	istat: long(0), $	; 48- Flag stat errors written
	spare2: bytarr(12) }	; 52- Spare should be spaces

Bsd_roadmap = { Bsd_road, $     ; BSD roadmap records also called pointers.
        offset: lonarr(4), $    ; 00- Pointer offset values.
        exist:  bytarr(4)}      ; 16- **Flag =1 if data exist for this channel.
        
BSD_data = { Bsd_data, $        ; Bsd Data structure.
        counts: fltarr(256), $  ; 00- Counts 
        bins:   fltarr(256), $  ; 04*256- bins 
        wave:   fltarr(256), $  ; 08*256- Wavelength
	error:  fltarr(256)}    ; 12*256- Statistical errors 
				; - may not be present see index.istat
end
	
