scikit-spectra
scikit-spectra copied to clipboard
Dark subtraction and float restrictions
SpecIndex ought to have some sort of precision rounding. Otherwise, get issues. The baseline subtractino index, for example, is due to non equivalence put to exp-13 ish decimal places of indicies with float data of .2
I'm thinking specindex should have a rounding attribute that defaults either upon initialization or something, and then rounds anything that gets put in.
At this point, specindex class is worth making.
Check out np datatypes:
http://docs.scipy.org/doc/numpy/user/basics.types.html
Think I should choose a default one and force into so that dtype object not returned. Also, when doing rounding and probably other np functions, need to access ts.index.values (eg np.round(ts.index.values, 8)). Can change representations using as type.
Thinking overall, have default type as float 16 or 32 bit (look into each) and then use can call various representations (store valid ones in tuple?) Maybe make this a ts method that calls underlying index? In any case, if specindex, will attempt to call astype() and return. Also should have a rounding cutoff, that can be turned off if user wants. Otherwise, stays on and helps align data.
Hmm seems like numpy defaults to float 64 and attempting to alter default construction could be a can of worms:
http://stackoverflow.com/questions/5721831/python-making-numpy-default-to-float32
Instead, just convert object to dtype=float64 upon construction and then user changes can always just call as dtype...
Some interesting knowledge: If data types are ints, can used unsigned integers to represent bigger lengths of positive numbers (useful for storing particular character alphabets). Signed are more useful for storing number for use in applications/real math. Floats types are represented in the number of exponents they can store rather than their max and min values. 16bit stores five slots, 32 stores 8, 64 stores 11.
Also a bit worried about how I define constants like c and h and stuff. Should I define these as np.64 types etc...