scikit-spectra icon indicating copy to clipboard operation
scikit-spectra copied to clipboard

Dark subtraction and float restrictions

Open hughesadam87 opened this issue 11 years ago • 3 comments

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.

hughesadam87 avatar Mar 11 '13 19:03 hughesadam87

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.

hughesadam87 avatar Mar 11 '13 19:03 hughesadam87

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.

hughesadam87 avatar Mar 11 '13 19:03 hughesadam87

Also a bit worried about how I define constants like c and h and stuff. Should I define these as np.64 types etc...

hughesadam87 avatar Mar 11 '13 20:03 hughesadam87