Flexion-Extension of Functional Spine Units#

Cervical spine functional spine units flexion and extension responses compared to Nightingale el al. (2002) and Wheeldon et al. (2006)

  • Performed by: I Putu Alit Putra, Chiara Fichera

  • Notebook prepared by: Chiara Fichera

  • Reviewed by:

Last modified: 2023-03-20

VIVA+ model version (this notebook run for): 0.3.2

© 2019-2023, OpenVT Organization (OVTO)

Available openly under under Creative Commons Attribution 4.0 International License

Flexion-Extension#

Hide code cell content
def filtering_extension(df): # filter the dataframe and return min index in Dataframe that satisfy condition Moment > -3
    mask = df.moment.Moment  > -3 
    ind = mask.index[mask['kilogram * meter ** 2 / second ** 2'] == False]
    min_idx = ind.min()
    return min_idx

def filtering_flexion(df):  # filter the dataframe and return min index in Dataframe that satisfy condition of Moment  < 3
    mask = df.moment.Moment  < 3
    ind = mask.index[mask['kilogram * meter ** 2 / second ** 2'] == False]
    min_idx = ind.min()
    return min_idx

# Flexion index
C0_C2_50F_flex_ind = filtering_flexion(C0_C2.C0_C2_Flexion_50F)
C0_C2_50M_flex_ind = filtering_flexion(C0_C2.C0_C2_Flexion_50M)

C2_C3_50F_flex_ind = filtering_flexion(C2_C3.C2_C3_Flexion_50F)
C2_C3_50M_flex_ind = filtering_flexion(C2_C3.C2_C3_Flexion_50M)

C3_C4_50F_flex_ind = filtering_flexion(C3_C4.C3_C4_Flexion_50F)
C3_C4_50M_flex_ind = filtering_flexion(C3_C4.C3_C4_Flexion_50M)

C4_C5_50F_flex_ind = filtering_flexion(C4_C5.C4_C5_Flexion_50F)
C4_C5_50M_flex_ind = filtering_flexion(C4_C5.C4_C5_Flexion_50M)

C5_C6_50F_flex_ind = filtering_flexion(C5_C6.C5_C6_Flexion_50F)
C5_C6_50M_flex_ind = filtering_flexion(C5_C6.C5_C6_Flexion_50M)

C6_C7_50F_flex_ind = filtering_flexion(C6_C7.C6_C7_Flexion_50F)
C6_C7_50M_flex_ind = filtering_flexion(C6_C7.C6_C7_Flexion_50M)

C7_T1_50F_flex_ind = filtering_flexion(C7_T1.C7_T1_Flexion_50F)
C7_T1_50M_flex_ind = filtering_flexion(C7_T1.C7_T1_Flexion_50M)
# Extension index
C0_C2_50F_ext_ind = filtering_extension(C0_C2.C0_C2_Extension_50F)
C0_C2_50M_ext_ind = filtering_extension(C0_C2.C0_C2_Extension_50M)

C2_C3_50F_ext_ind = filtering_extension(C2_C3.C2_C3_Extension_50F)
C2_C3_50M_ext_ind = filtering_extension(C2_C3.C2_C3_Extension_50M)

C3_C4_50F_ext_ind = filtering_extension(C3_C4.C3_C4_Extension_50F)
C3_C4_50M_ext_ind = filtering_extension(C3_C4.C3_C4_Extension_50M)

C4_C5_50F_ext_ind = filtering_extension(C4_C5.C4_C5_Extension_50F)
C4_C5_50M_ext_ind = filtering_extension(C4_C5.C4_C5_Extension_50M)

C5_C6_50F_ext_ind = filtering_extension(C5_C6.C5_C6_Extension_50F)
C5_C6_50M_ext_ind = filtering_extension(C5_C6.C5_C6_Extension_50M)

C6_C7_50F_ext_ind = filtering_extension(C6_C7.C6_C7_Extension_50F)
C6_C7_50M_ext_ind = filtering_extension(C6_C7.C6_C7_Extension_50M)

C7_T1_50F_ext_ind = filtering_extension(C7_T1.C7_T1_Extension_50F)
C7_T1_50M_ext_ind = filtering_extension(C7_T1.C7_T1_Extension_50M)
Hide code cell source
fig_fe, ((ax1, ax2), (ax3, ax4), (ax5, ax6), (ax7,ax8)) = plt.subplots(4,2,sharey= True,  figsize=(8, 10))

ax1.set(title='OC - C2')
ax2.set(title='C2 - C3')
ax3.set(title='C3 - C4')
ax4.set(title='C4 - C5')
ax5.set(title='C5 - C6')
ax6.set(title='C6 - C7', xlabel='Rotation (degrees)')
ax7.set(title='C7 - T1', xlabel='Rotation (degrees)')

# CO-C2
ax1.plot(C0_C2.C0_C2_Extension_50F.rotation.Rotation[:C0_C2_50F_ext_ind] * rad_to_deg,  C0_C2.C0_C2_Extension_50F[:C0_C2_50F_ext_ind].moment.Moment, **plot50F,label = 'VIVA+ 50F')
ax1.plot(C0_C2.C0_C2_Flexion_50F.rotation.Rotation[:C0_C2_50F_flex_ind] * rad_to_deg, C0_C2.C0_C2_Flexion_50F[:C0_C2_50F_flex_ind].moment.Moment, **plot50F)
ax1.plot(C0_C2.C0_C2_Extension_50M.rotation.Rotation[:C0_C2_50M_ext_ind] * rad_to_deg,  C0_C2.C0_C2_Extension_50M[:C0_C2_50M_ext_ind].moment.Moment, **plot50M, label = 'VIVA+ 50M')
ax1.plot(C0_C2.C0_C2_Flexion_50M.rotation.Rotation[:C0_C2_50M_flex_ind] * rad_to_deg, C0_C2.C0_C2_Flexion_50M[:C0_C2_50M_flex_ind].moment.Moment, **plot50M)

ax1.plot(nightingale_M.O_C2_Lower.Y, nightingale_M.O_C2_Lower.X, **plotExperimentMale, label = 'Nightingale 2007 (males)')
ax1.plot(nightingale_M.O_C2_Upper.Y, nightingale_M.O_C2_Upper.X, **plotExperimentMale)
ax1.autoscale(axis='x')
# C2-C3
ax2.plot(C2_C3.C2_C3_Extension_50F.rotation.Rotation[:C2_C3_50F_ext_ind] * rad_to_deg,  C2_C3.C2_C3_Extension_50F[:C2_C3_50F_ext_ind].moment.Moment, **plot50F)
ax2.plot(C2_C3.C2_C3_Flexion_50F.rotation.Rotation[:C2_C3_50F_flex_ind] * rad_to_deg, C2_C3.C2_C3_Flexion_50F[:C2_C3_50F_flex_ind].moment.Moment, **plot50F)
ax2.plot(C2_C3.C2_C3_Extension_50M.rotation.Rotation[:C2_C3_50M_ext_ind] * rad_to_deg,  C2_C3.C2_C3_Extension_50M[:C2_C3_50M_ext_ind].moment.Moment, **plot50M)
ax2.plot(C2_C3.C2_C3_Flexion_50M.rotation.Rotation[:C2_C3_50M_flex_ind] * rad_to_deg, C2_C3.C2_C3_Flexion_50M[:C2_C3_50M_flex_ind].moment.Moment, **plot50M)

ax2.plot(wheeldon.C2_C3.Lower.Rotation, wheeldon.C2_C3.Lower.Moment, **plotExperiment, label = 'Wheeldon 2006')
ax2.plot(wheeldon.C2_C3.Upper.Rotation, wheeldon.C2_C3.Upper.Moment, **plotExperiment)
ax2.set_xlim(-12,12)
ax2.set_ylim(-3,3)

#C3-C4
ax3.plot(C3_C4.C3_C4_Extension_50F.rotation.Rotation[:C3_C4_50F_ext_ind] * rad_to_deg,  C3_C4.C3_C4_Extension_50F[:C3_C4_50F_ext_ind].moment.Moment, **plot50F)
ax3.plot(C3_C4.C3_C4_Flexion_50F.rotation.Rotation[:C3_C4_50F_flex_ind] * rad_to_deg, C3_C4.C3_C4_Flexion_50F[:C3_C4_50F_flex_ind].moment.Moment, **plot50F)
ax3.plot(C3_C4.C3_C4_Extension_50M.rotation.Rotation[:C3_C4_50M_ext_ind] * rad_to_deg,  C3_C4.C3_C4_Extension_50M[:C3_C4_50M_ext_ind].moment.Moment, **plot50M)
ax3.plot(C3_C4.C3_C4_Flexion_50M.rotation.Rotation[:C3_C4_50M_flex_ind] * rad_to_deg, C3_C4.C3_C4_Flexion_50M.moment.Moment[:C3_C4_50M_flex_ind], **plot50M)
ax3.plot(wheeldon.C3_C4.Lower.Rotation, wheeldon.C3_C4.Lower.Moment, **plotExperiment)
ax3.plot(wheeldon.C3_C4.Upper.Rotation, wheeldon.C3_C4.Upper.Moment, **plotExperiment)

ax3.plot(nightingale_F.C3_C4_Lower.Rotation, nightingale_F.C3_C4_Lower.Moment, **plotExperimentFemale,label = 'Nightingale 2002 (females)')
ax3.plot(nightingale_F.C3_C4_Upper.Rotation, nightingale_F.C3_C4_Upper.Moment, **plotExperimentFemale)
ax3.set_xlim(-12,12)
ax3.set_ylim(-3,3)
# C4-C5
ax4.plot(C4_C5.C4_C5_Extension_50F.rotation.Rotation[:C4_C5_50F_ext_ind] * rad_to_deg,  C4_C5.C4_C5_Extension_50F.moment.Moment[:C4_C5_50F_ext_ind], **plot50F)
ax4.plot(C4_C5.C4_C5_Flexion_50F.rotation.Rotation[:C4_C5_50F_flex_ind] * rad_to_deg, C4_C5.C4_C5_Flexion_50F.moment.Moment[:C4_C5_50F_flex_ind], **plot50F)
ax4.plot(C4_C5.C4_C5_Extension_50M.rotation.Rotation[:C4_C5_50M_ext_ind] * rad_to_deg,  C4_C5.C4_C5_Extension_50M.moment.Moment[:C4_C5_50M_ext_ind], **plot50M)
ax4.plot(C4_C5.C4_C5_Flexion_50M.rotation.Rotation[:C4_C5_50M_flex_ind] * rad_to_deg, C4_C5.C4_C5_Flexion_50M.moment.Moment[:C4_C5_50M_flex_ind], **plot50M)

ax4.plot(nightingale_M.C4_C5_Lower.Y, nightingale_M.C4_C5_Lower.X, **plotExperimentMale)
ax4.plot(nightingale_M.C4_C5_Upper.Y, nightingale_M.C4_C5_Upper.X, **plotExperimentMale)

ax4.plot(wheeldon.C4_C5.Lower.Rotation, wheeldon.C4_C5.Lower.Moment, **plotExperiment)
ax4.plot(wheeldon.C4_C5.Upper.Rotation, wheeldon.C4_C5.Upper.Moment, **plotExperiment)

ax4.set_xlim(-12,12)
ax4.set_ylim(-3,3)
# C5-C6
ax5.plot(C5_C6.C5_C6_Extension_50F.rotation.Rotation[:C5_C6_50F_ext_ind] * rad_to_deg,  C5_C6.C5_C6_Extension_50F.moment.Moment[:C5_C6_50F_ext_ind], **plot50F)
ax5.plot(C5_C6.C5_C6_Flexion_50F.rotation.Rotation[:C5_C6_50F_flex_ind] * rad_to_deg, C5_C6.C5_C6_Flexion_50F.moment.Moment[:C5_C6_50F_flex_ind], **plot50F)
ax5.plot(C5_C6.C5_C6_Extension_50M.rotation.Rotation[:C5_C6_50M_ext_ind] * rad_to_deg,  C5_C6.C5_C6_Extension_50M.moment.Moment[:C5_C6_50M_ext_ind], **plot50M)
ax5.plot(C5_C6.C5_C6_Flexion_50M.rotation.Rotation[:C5_C6_50M_flex_ind] * rad_to_deg, C5_C6.C5_C6_Flexion_50M.moment.Moment[:C5_C6_50M_flex_ind], **plot50M)
ax5.plot(wheeldon.C5_C6.Lower.Rotation, wheeldon.C5_C6.Lower.Moment, **plotExperiment)
ax5.plot(wheeldon.C5_C6.Upper.Rotation, wheeldon.C5_C6.Upper.Moment, **plotExperiment)

ax5.plot(nightingale_F.C5_C6_Lower.Rotation, nightingale_F.C5_C6_Lower.Moment, **plotExperimentFemale)
ax5.plot(nightingale_F.C5_C6_Upper.Rotation, nightingale_F.C5_C6_Upper.Moment, **plotExperimentFemale)
ax5.set_xlim(-12,12)
ax5.set_ylim(-3,3)
# C6-C7
ax6.plot(C6_C7.C6_C7_Extension_50F.rotation.Rotation[:C6_C7_50F_ext_ind] * rad_to_deg,  C6_C7.C6_C7_Extension_50F.moment.Moment[:C6_C7_50F_ext_ind], **plot50F)
ax6.plot(C6_C7.C6_C7_Flexion_50F.rotation.Rotation[:C6_C7_50F_flex_ind] * rad_to_deg, C6_C7.C6_C7_Flexion_50F.moment.Moment[:C6_C7_50F_flex_ind], **plot50F)
ax6.plot(C6_C7.C6_C7_Extension_50M.rotation.Rotation[:C6_C7_50M_ext_ind] * rad_to_deg,  C6_C7.C6_C7_Extension_50M.moment.Moment[:C6_C7_50M_ext_ind], **plot50M)
ax6.plot(C6_C7.C6_C7_Flexion_50M.rotation.Rotation[:C6_C7_50M_flex_ind]  * rad_to_deg, C6_C7.C6_C7_Flexion_50M.moment.Moment[:C6_C7_50M_flex_ind] , **plot50M)

ax6.plot(nightingale_M.C6_C7_Lower.Y, nightingale_M.C6_C7_Lower.X, **plotExperimentMale)
ax6.plot(nightingale_M.C6_C7_Upper.Y, nightingale_M.C6_C7_Upper.X, **plotExperimentMale)

ax6.plot(wheeldon.C6_C7.Lower.Rotation, wheeldon.C6_C7.Lower.Moment, **plotExperiment)
ax6.plot(wheeldon.C6_C7.Upper.Rotation, wheeldon.C6_C7.Upper.Moment, **plotExperiment)
ax6.set_xlim(-12,12)
ax6.set_ylim(-3,3)
# C7-T1
ax7.plot(C7_T1.C7_T1_Extension_50F.rotation.Rotation[:C7_T1_50F_ext_ind] * rad_to_deg,  C7_T1.C7_T1_Extension_50F.moment.Moment[:C7_T1_50F_ext_ind], **plot50F)
ax7.plot(C7_T1.C7_T1_Flexion_50F.rotation.Rotation[:C7_T1_50F_flex_ind] * rad_to_deg, C7_T1.C7_T1_Flexion_50F.moment.Moment[:C7_T1_50F_flex_ind], **plot50F)
ax7.plot(C7_T1.C7_T1_Extension_50M.rotation.Rotation[:C7_T1_50M_ext_ind] * rad_to_deg,  C7_T1.C7_T1_Extension_50M.moment.Moment[:C7_T1_50M_ext_ind], **plot50M)
ax7.plot(C7_T1.C7_T1_Flexion_50M.rotation.Rotation[:C7_T1_50M_flex_ind] * rad_to_deg, C7_T1.C7_T1_Flexion_50M.moment.Moment[:C7_T1_50M_flex_ind], **plot50M)
ax7.plot(wheeldon.C7_T1.Lower.Rotation, wheeldon.C7_T1.Lower.Moment, **plotExperiment)
ax7.plot(wheeldon.C7_T1.Upper.Rotation, wheeldon.C7_T1.Upper.Moment, **plotExperiment)

ax7.plot(nightingale_F.C7_T1_Lower.Rotation, nightingale_F.C7_T1_Lower.Moment, **plotExperimentFemale)
ax7.plot(nightingale_F.C7_T1_Upper.Rotation, nightingale_F.C7_T1_Upper.Moment, **plotExperimentFemale)
ax7.set_xlim(-12,12)
ax7.set_ylim(-3,3)
fig_fe.supylabel("Moment (Nm)", fontsize ='x-large')
fig_fe.tight_layout(pad=0.7)
fig_fe.legend(loc='center left', bbox_to_anchor=(0.6, 0.15))
fig_fe.delaxes(ax8)
../_images/d86bb955c187aac6816c9cf3451aa735a5b0da366fe2dd356bf7949e059eb3ab.png