chi-squared tests in python?

2006-01-17 Thread Matthew Vernon
Hi,

I'd like to be able to use the chi-squared test in my code. Currently,
I can output "look up [this value] in a chi-squared table with [x]
degrees of freedom", but that's obviously a little sub-optimal. I
notice that numarray has a chi_square function, but that just gives
you random numbers from a chi-squared distribution with a set number
of degrees of freedom - not really what I want.

Does there exist python code to do this? preferably something vaguely
standard? 

Thanks,

Matthew
ps: given the "batteries included" philosphy, there's a remarkable dearth 
of stats in python...
-- 
Matthew Vernon MA VetMB LGSM MRCVS
Farm Animal Epidemiology and Informatics Unit
Department of Veterinary Medicine, University of Cambridge
http://www.cus.cam.ac.uk/~mcv21/
-- 
http://mail.python.org/mailman/listinfo/python-list


loading configuration files that are themselves python

2010-07-03 Thread Matthew Vernon
Hi,

Is there a more idiomatic way of loading in a configuration file
that's python code than:

_temp=__import__(path,fromlist='cachestrs')
cachestrs=_temp.cachestrs

? I mean, that's pretty ugly...Plain "import" doesn't work in this
case because 'path' is a variable defined elsewhere

TIA,

Matthew

-- 
Rapun.sel - outermost outpost of the Pick Empire
http://www.pick.ucam.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: loading configuration files that are themselves python

2010-07-03 Thread Matthew Vernon
Peter Otten <[email protected]> writes:

> Matthew Vernon wrote:
> 
> > Is there a more idiomatic way of loading in a configuration file
> > that's python code than:
> > 
> > _temp=__import__(path,fromlist='cachestrs')
> > cachestrs=_temp.cachestrs
> > 
> > ? I mean, that's pretty ugly...Plain "import" doesn't work in this
> > case because 'path' is a variable defined elsewhere
> 
> execfile(path) 
> 
> in a module with a fixed name that you can import wherever you need access 
> to your configuration data?

That looks like what I want, thanks :)

Matthew

-- 
Rapun.sel - outermost outpost of the Pick Empire
http://www.pick.ucam.org
-- 
http://mail.python.org/mailman/listinfo/python-list