BielStela / Elliptic-Fourier-Python

Elliptic Fourier Descriptors adapted from the book Morphometric with R (Julien Claude)
1 stars 0 forks source link

problem with your script #1

Closed mlaloux closed 8 years ago

mlaloux commented 8 years ago

I have big problems with your script (Python 2.7.10 and 3.5) 1) t1, t1m1 are pandas DataFrames therefore cos(2_i_np.pi_t1/T and cos(2_np.pi_i_t1m1/T) gives me an error Python 2.7 - TypeError: a float is required Python 3.5 - TypeError: 'float' object cannot be interpreted as an integer 2) if you use cos with math, you need math.cos or np.cos( 3) coords = iefourier(coef.an,coef.bn,coef.cn,coef.dn,i,n,ao,co) iefourier = efourier ?

BielStela commented 8 years ago

@mlaloux Thanks for the comment. The script was a bit abandoned time ago but since you are interested i'll upload a better version ASAP. I'm interested in why do you want to use EFD?

mlaloux commented 8 years ago

I use classic Fourier analysis a long time ago for analysing Foraminifers in my thesis (1988) with a Basic script and now I am testing the solutions in Python (Elliptic Fourier) to compare (I try also the R solutions)

BielStela commented 8 years ago

I uploaded a new version with np.cos. In my pc it works on python 2.7. I also have an R package for elliptic fourier called VisioBioShapeR but it is in heavy beta yet. I use the EFD for classify Diatomees and all kind of shapes.

BielStela commented 8 years ago

And of course, @mlaloux, feel free to comment, add, ask or suggest anything you want.

mlaloux commented 8 years ago

What is the format of the file Gomphonema.txt because for me the result of t1/T is a dataframe, therefore error a float is required Thanks

BielStela commented 8 years ago

it is a .csv file with two columns , one for the X coordinate and one for the Y. I uploaded it so you can use it or compare the data structure. For extracting the outlines coordinates I used R or imageJ.

mlaloux commented 8 years ago

Thanks but an[i]=(T/(2_np.pi__2_i_2))np.sum((Dx/Dt)(np.cos(2_i_np.pi_t1/T)-np.cos(2_np.pi_it1m1/T)))

give me the error sum() got an unexpected keyword argument 'dtype'

BielStela commented 8 years ago

I don't get wats going on. I run it all without problem in my windows 10 machines with python 2.7, pandas 0.18 and numpy 1.10. I don't have a clue why happening. Are you running it in a Jupyter notebook?

mlaloux commented 8 years ago

I think it is a problem with the versions of numpy and pandas and I will continue tonight, thanks

mlaloux commented 8 years ago

Ok, it works with numpy 1.11 and pandas 0.18, not with Pandas 0.17, many thanks

BielStela commented 8 years ago

Great, I'm glad it works. If you want check out VisioBioShapeR. An R package for analyzing contours with EFD and aimed to make easy the feature extraction of shapes for further classification with machine learning algorithms.