niuhuifei / dadi

Automatically exported from code.google.com/p/dadi
Other
1 stars 0 forks source link

More robust handling of folded spectra desirable #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Working with a folded Spectrum is at present a little tricky. In particular, 
refolding a folded 
Spectrum wipes out almost all entries, and this can be done implicitly in the 
optimizer.

I think the proper solution is to have Spectrum objects record whether or not 
they are folded.

1. Add an isfolded member variable to Spectrum objects. (Use Python property 
functionality?)
2. Record isfolded status in the saved files.
3. Make optimizer handle folding automatically, folding the model result if the 
data is folded, for 
example.
4. It doesn't make sense to project a folded Spectrum, because during 
projection it is possible for 
minor allele status to switch. To deal with this, we need an unfold() method 
that will assume each 
allele is minor with 50% probability. Then we can raise an exception when 
projecting a folded 
Spectrum.

Original issue reported on code.google.com by rgutenkunst@gmail.com on 18 Sep 2009 at 1:33

GoogleCodeExporter commented 9 years ago
Adding a .folded attribute to the Spectrum class was more complicated than 
expected. I had to substantially 
rework things to properly inherit from numpy.ma.masked_array.

I've changed to_file and from_file to store and read folded and mask 
information.

All the methods in Inference and Plotting now automatically fold the model when 
the data is folded. Similarly,
folded spectra can be projected, marginalized, and sampled from. In all these 
cases, the Spectrum is first 
unfolded, then operated on, then the result folded.

Original comment by rgutenkunst@gmail.com on 7 Oct 2009 at 8:45