===============================================================================================
             Tobyfit
===============================================================================================
Urgent:
- New classes: get moderator refinement working again (need to go back to mfclass_tobyfit/fit to alter how moderator
 information is stored)
- check RAE's correction to DGdisk (either the init routine, or the main routine)
- RAE's bind_lattice in refine_crystal
	- check
	- propagate to Tobyfit
- Remove '-ave' option from sqw_eval for all dnd methods (does not apply!)
- spec_coords_to_det returns detdcn as a 3x1xN array, not 3xN. Correct this, but
  check the unit tests work. Update the unit tests.
- Index detpar in Tobyift init routines: very time consuming to calculate each time,
  and takes a lot of memory.
- detectors do not have sintheta for out-of-plane
- test routine to confirm equivalence with resolution function covariance


- Make Tobyfit test instrument type (so don't need to do 'disk' or 'fermi')

===============================================================================================
Little things to check:

- refine crystal and moderator: at the fit or simulate stage as well as set stage, check that
  there is at least one foreground function
  
- The tests for refine xtal & mod are not fully consistent in terms of how empty fields are
  interpreted: for example: uvec is returned as [1,0,0], not [] in set_refine_crystal, unlike
  the lattice parameters, and set_refine_moderator uses the mod pars as they are in the current
  datasets at the time of being issued, whereas the crystal picls up the lattice parameters
  at the fit or simulate stage. refine_moderator: checks ei in both set_refine_moderator and
  at the fit or simulate stage in pack_parameters.

- Make detpar carry more information (as detector.dat) - needed to get tube orientations

- Check that all tube types are the same

- Probably need to make instruments a class, rather than arbitrary structures

- Refinements to viewing the fit:
	- Way of displaying large covariance matrix elements at a glance
	- Plot results at each iteration?
	- display parameters with nlist=2 that make sense: i.e. unpack
	  as for final listing rather than just show the free parameters
	- Function to print to screen the output parameters of a fit
	  just like the screen printout at the end of a fit

- Allow stored tables to be ignored, so system tests are reliable?
  
Bugs
====
qmat in disk chopper. transverse q components of bmat

A single sqw, all points masked (zero errors, for example): causes a crash in 
  Undefined operator './' for input arguments of type 'cell'.

Error in initial_pulse_DGdisk>shaped_mod_pulse (line 108)
    trans = 1 - abs(t_sh)./chop_fwhh;
	

	
Improvements
============	
tobyfit_DGdisk_resconv_init, and sim. fermi:
	- detpar can be indexed (usually will have the same detector parameter files);
	  that goes for x2 as well, mayber other properties
	  
Disk chopper has 10atm LET tubes hard-wired

tobyfit should be able to determine the instrument type from the header.instrument
	
There are touines that are copied in sqw/private and tobyfit - bring together in one place
	
Interface
==========	
(Speak to Alex about his ideas too)

set_data, set_mask etc.  should have data, mask mirrors that take the same input

val = obj.data
  :
obj.data = val

obj = obj.set_data(val) 	% set_data may have more flexibility

The methods that shoudl have this behaviour are 






Organisation
============
Speed: the buffering of hundreds of IX_divergence_profile takes a long time to read from
file: it is because of the time spent in IX_divergence_profile/sort, equally split
between struct_special and nestedSortStruct. I think this is peculiar to divergence,
not chopper or moderator, as only short arrays are checked in these cases.


tobyfit2 shoudl not be a method, but a function.

It should be able to determine which type of resolution function model from the instrument
type, which in turn should therefore also be an object. The resolution fuinction model should 
be a method of the instrument, not sqw object. It will be inherited?


===============================================================================================
             Tests
===============================================================================================
Test crystal refinement, moderator refinement with sqw models that are different for different
data sets, to test that the appended constraints are inserted correctly.



===============================================================================================
             Horace
===============================================================================================

Put recompute_bin_data as a public method. Need to replace recompute_bin_data_tester with
this name (it is just a dummy call to give access to the private method)

Dreadfully slow 'get' for config properties

Noisify has a problem with the size ofthe error bars

fake_sqw problem

set_mod_pulse_horace problem 









