csu-hmc / perturbed-data-paper

A paper on an elaborate gait data set.
https://peerj.com/articles/918/
10 stars 6 forks source link

How can I change the octave engine to the matlab engine in your code. #178

Closed nikorose87 closed 5 years ago

nikorose87 commented 6 years ago

Hi.

I am really interested in analyzing your data from the paper. but somehow I cannot compile octave on CentOS. Thus I cannot run your code in python and I really need all the info in that programming language.

I there any way to specify the Matlab engine in your code either manually or automatically (compiled).

Thanks.

moorepants commented 6 years ago

Matlab has some Python bridges in the latest version. You could likely adopt it with some work.

My recommendation would be to run the code from this branch: https://github.com/csu-hmc/GaitAnalysisToolKit/pull/128 which completely removes the octave dependency.

nikorose87 commented 6 years ago

Hi again

I could run your code made entirely in python, however, processing the inverse_dynamics_2d this error came up:

ValueError: Digital filter critical frequencies must be 0 < Wn < 1

Checking the code, the value of Wn is around 24.

This is the code to give you an idea of what is happening, however, It is likely the same that you have in the paper.

# =============================================================================
# Setting the variables according to the marker and forces, referenced in the paper
# =============================================================================
data = DFlowData(Datadir+'mocap-020.txt',Datadir+'record-020.txt',Datadir+'meta-020.yml')
mass = data.meta['subject']['mass']
# List of markers
body_parts = ['SHO','GTRO','LEK','LM','HEE','MT5']
body_parts_l = ['L'+c+e for c in body_parts for e in ['.PosX','.PosY']]
body_parts_r = ['R'+c+e for c in body_parts for e in ['.PosX','.PosY']]
#List of forces cells
forces_l = ['FP'+str(1)+c for c in ['.ForX','.ForY','.MomZ']]
forces_r = ['FP'+str(2)+c for c in ['.ForX','.ForY','.MomZ']]

data.clean_data()

event_df = data.extract_processed_data(event='Longitudinal Perturbation')
Gaitdata = gait.GaitData(event_df)
Gaitdata.inverse_dynamics_2d(body_parts_l, body_parts_r,
                          forces_l, forces_r, mass, 6.0)

should I try with another filter or should I reduced the cutoff? Thanks Dr. Moore.

nikorose87 commented 6 years ago

Sorry

I have another questions:

After the Inverse Dynamics, some columns are generated, I can appreciate Angles, Moments, Rates and Forces, but I cannot see power. Is the same as Forces with the mass implied?

In the paper you have the following line:

gdata.grf_landmarks(’Right Fy’, ’Left Fy’, threshhold=20.0)

The values for Right and Left Fy are those ones that finish in ForY? or are the ones who are labeled F1Y1?

Thanks in advice.

nikorose87 commented 6 years ago

Hi

Let's say that I could solve it. I establish the samplerate as:

time = self.data['TimeStamp'].values.astype(float)

The line that you had, returned to me the list of the indexes, not the time between samples, thus the value of Wn was really high.

Now, I don't know how much affect the following warning in the IK:

Segment length changed by more than 0.1 meters.

Thanks.

moorepants commented 5 years ago

I'm not sure if this helps but the master branch of GTK now functions with the latest dependencies. You'd still need to do some work to avoid Octave though.

moorepants commented 5 years ago

If you are using conda, can you install octave using it? It should install on CentOS. You can try octave from the conda-forge channel.

nikorose87 commented 5 years ago

Don´t worry. I could figure out synchronizing matlab instead octave. However, I do not know why I could not split your data. I had to do it manually.

Anyway, I will tell you how it goes. Thanks