;
  Observables

	;A full list of possible "observables" is in
	;$FORWARD/OBSERVABLES/for_obs_setup.pro
	;There are different types of observable.
	;1) Model parameters. These depend on the particular model - some
	;	models (e.g., CAVFIT) model plasma parameters but not magnetic
	;	field, for instance For the plots most of these are shown in
	;	the plane of the sky, e.g.,

ngrid=512

	;Density:

for_drive,'cavmorph',line='Dens',/plotlog,xxmin=.3,xxmax=2,yymin=.3,yymax=2,$
		readprams='$FORWARD/MODELS/CAVMORPH/aug07fitnew.genx'

	;Br, the radial component for the magnetic field:	

for_drive,'giblow',line='Br',ngrid=ngrid,xxmin=.8,xxmax=1.5,yymin=-.3,yymax=.3

	;As mentioned in an earlier example, these can be obtained for
	;particular points in three dimentional space:

gridt='userinput'
ruser=replicate(1.1,180)
thuser=findgen(180)
phuser=replicate(0.,180)

for_drive,'giblow',gridt=gridt,ruser=ruser,thuser=thuser,phuser=phuser,lin='Bmag',quant=Bmag

plot,thuser,bmag.data,xtitle='heliographic latitude (deg)',title=Bmag.id,color=0

	;
	;2)There are also observables that actually seek to replicate
	;	observed quantities. This usually involve integration along the
	;	line of sight. For instance the polarized brightness (PB):
	
ngrid=64

for_drive,'cavmorph',line='pB',/plotlog,xxmin=.3,xxmax=1.5,yymin=.3,yymax=1.5,$
		ngrid=ngrid,readprams='$FORWARD/MODELS/CAVMORPH/aug07fitnew.genx'
		
	;Some of these are connected to particular instrument, so the INST
	;keyword is used: 
	;for SDO/AIA 193 A:

for_drive,'cavmorph',line='193',Inst='AIA',/plotlog,xxmin=0,xxmax=1.5,yymin=0,$
	yymax=1.5,ngrid=ngrid,/dodisk,$
	readprams='$FORWARD/MODELS/CAVMORPH/aug07fitnew.genx'

	;intensities such as these are based on emission measure
	;for diagnostic purposes it can be usesful to plot these

for_drive,'cavmorph',inst='losem',/plotlog,xxmin=0,xxmax=1.5,yymin=0,$
	yymax=1.5,ngrid=ngrid,/dodisk,$
	readprams='$FORWARD/MODELS/CAVMORPH/aug07fitnew.genx'

	;can also do column density 

for_drive,'cavmorph',inst='colden',/plotlog,xxmin=0,xxmax=1.5,yymin=0,$
	yymax=1.5,ngrid=ngrid,/dodisk,$
	readprams='$FORWARD/MODELS/CAVMORPH/aug07fitnew.genx'

	; RADIO observations can be done, with a frequency set
	; can plot I, V, V/I

for_drive,'giblow',/radio,frequency_MHz=1d3,/plotlog,line='I',$
	ngrid=ngrid,cmer=0,/savemap,mapname='giblow_radio_center',winnum=2,imin=3,imax=7
for_drive,'giblow',line='VoI',readmap='giblow_radio_center.sav',winnum=3,imin=-.001,imax=.001

for_drive,'giblow',/radio,frequency_MHz=1d3,/plotlog,line='I',$
	ngrid=ngrid,cmer=-90,/savemap,mapname='giblow_radio_limb',winnum=0,imin=3,imax=7
for_drive,'giblow',line='VoI',readmap='giblow_radio_limb.sav',winnum=1,imin=-.001,imax=.001

for_drive,'giblow',/radio,frequency_MHz=1d2,/plotlog,line='I',$
	ngrid=ngrid,cmer=0,/savemap,mapname='giblow_radio_low_center',winnum=6,imin=3,imax=7
for_drive,'giblow',line='VoI',readmap='giblow_radio_low_center.sav',winnum=4,imin=-.001,imax=.001

for_drive,'giblow',/radio,frequency_MHz=1d2,/plotlog,line='I',$
	ngrid=ngrid,cmer=-90,/savemap,mapname='giblow_radio_low_limb',winnum=5,imin=3,imax=7
for_drive,'giblow',line='VoI',readmap='giblow_radio_low_limb.sav',winnum=7,imin=-.001,imax=.001

	; that was just bremstrahllung, can also turn on gyroresonance
	; to make it interesting, we will use the BONLY option of the Gibson & Low model
	; where we can scale the magnetic field strength (using AO) but have density/temperature
	; be spherically symmetric except depleted in density by a factor of two in the spheromak region
				
for_drive,'giblow',/radio,frequency_MHz=5d2,/plotlog,line='VoI',extratitle='Bmax=1000.',$
	ngrid=ngrid,cmer=0,/dogyro,/bonly,ao=1000.,winnum=9,imin=-.5,imax=.5

for_drive,'giblow',/radio,frequency_MHz=5d2,/plotlog,line='VoI',extratitle='Bmax=100.',$
	ngrid=ngrid,cmer=0,/dogyro,/bonly,ao=100.,winnum=8,imin=-.5,imax=.5

for_drive,'giblow',/radio,frequency_MHz=1d3,/plotlog,line='VoI',extratitle='Bmax=100.',$
	ngrid=ngrid,cmer=0,/dogyro,/bonly,ao=100.,winnum=10,imin=-.5,imax=.5

	; can also do faraday rotation

for_drive,'psimas',/faraday,frequency_MHz=1d3,line='FR',/plotlog,ngrid=ngrid,/dodisk,winnum=13,xxmin=-5.,xxmax=5.,yymin=-5.,yymax=5.,imin=-2.*!pi,imax=2.*!pi
for_drive,'psimas',/faraday,frequency_MHz=1d3,line='RM',/plotlog,$
	ngrid=ngrid,/dodisk,winnum=11,xxmin=-5.,xxmax=5.,yymin=-5.,yymax=5.


	;for COMP stokes parameters, IQUVW with magnetic field line overlaid 
	;(this will take a while!):
	;
	; NOTE: from the command line, for coronal polarimeters (Visible/IR)
	; instrument has to be set to
	;
	; 'comp','othercomp','si9comp','si10comp','greencomp'
	;
	; In the widget, these are more generically listed as 
	;
	; 'fe13_10747','fe13_10798','si9','si10','fe14'
	;
	;FIELDLINES - results in the POS component of the Bfield to be overplotted
	;  on the requested observable.
	;STKLINES is for an overplot of the STOKES vectors.	
	;Here SIG1 and BONLY are keywords specific to the GibLow model.
	; SIG1 rotates the flux rope on its axis
	; BONLY is a Gibson&Low model parameter that only keeps the magnetic 
	; field of that solution and imposes a hydrostatic density-temperature
	; background
	;VELIMPOSE puts a constant flow of speed VELIMPOSE km/sec along field lines-
	; will allow a demo of Doppler velocity 
	; NOTE THIS IS A Plane of Sky CALCULATION

for_drive,'giblow',inst='COMP',xxmin=0.9,xxmax=1.5,yymin=-.3,yymax=.3,$
	nwinx=512,nwiny=512,line='I',charsize=1.2,winnum=1,ngrid=128,ngy=128,velimpose=10.,/fieldlines,$
	/stklines,/savemap,mapname='giblowcomp',pscale=-.5,bscale=0,/pos

	;the results included the other stokes parameters and were saved, so
	;we can plot the other stokes parameters pretty easily:

for_drive,'giblow',inst='COMP',charsize=1.2,line='Q',$
		readmap='giblowcomp',winnum=2,nwinx=512,nwiny=512

for_drive,'giblow',inst='COMP',charsize=1.2,line='U',$
		readmap='giblowcomp',winnum=3,nwinx=512,nwiny=512

for_drive,'giblow',inst='COMP',charsize=1.2,line='LoI',/plotlog,$
		readmap='giblowcomp',winnum=4,nwinx=512,nwiny=512

for_drive,'giblow',inst='COMP',charsize=1.2,line='V',$
		readmap='giblowcomp',winnum=5,nwinx=512,nwiny=512
						
	;
	; we can plot line width and doppler velocity (assuming there is a velocity -
	; above we have set it through VELIMPOSE but in a numerical data cube it can
	; be explicitly included)
	;

for_drive,'giblow',inst='COMP',charsize=1.2,line='DOPPLERVLOS',$
		readmap='giblowcomp',winnum=6,nwinx=512,nwiny=512

for_drive,'giblow',inst='COMP',charsize=1.2,line='LINEWIDTH',$
		readmap='giblowcomp',winnum=7,nwinx=512,nwiny=512

;
; Finally - some notes on what is saved in the MAPNAME file
;
;   *********************
;       OUTPUT INCLUDES:
;
;          QUANTMAP: this is the quantity calculated, e.g., the particular
;               observable or physical diagnostic. It includes the DATA, and other
;               map parameters that define its center, pixelsize, etc.
;               It can be plotted or manipulated as a SolarSoft map structure.
;
;          STOKESSTRUCT: If the quantity calculated is a Coronal Polarimetric quantity,
;               I,Q, U, V are all saved here.  If parameter IWLINE is set (default)
;               the full wave profile is saved, along with velocities etc.
;               If the map is read in for one of these other quantities rather than the original
;               in QUANTMAP, FORWARD will replace the DATA in QUANTMAP with the new requested observable.
;
;          LOSPRAMSSTRUCT: Includes parameters defining viewers line of sight used in calculation
;          GRIDPRAMSSTRUCT: Includes parameters defining grid in plane of sky
;          OBSPRAMSSTRUCT: Includes parameters defining observable calculated
;          MODPRAMSSTRUCT: Includes parameters defining model used
;
;          MODSOLSTRUCT: Model values for physical parameters in the plane of sky
;
;          PLOTSAVE: Plotting choices for map - can be overwritten
;
;          LOSINPUTS, GRIDINPUTS, OBSINPUTS, MODELINPUTS: mostly redundent with the *PRAMSSTRUCT -
;               but in a form that enables quick loading of the widget fields
;
;
;  *********************

end
;