Muscle activity for muscle groups in selected output

Hi all,

I’ve been looking at the muscle activity for the muscles of the lower extremity in the Mocap example Lower Extremity model.

When I look at the activity of muscle groups in the selected output folder (e.g. HipFlexorMuscleActivity) there are several muscles included.

Is there a fast way to find out which muscles are included in the muscle group and which curve they are in the graph?

Kind regards and thank you for any help,

1 Like

Hi, Johanna,

Just find HipFlexorMuscleActivity from the SelectedOutput folder in the model tree, right-click, locate the anyscript, you’ll find the muscles included.

Best Regards,

1 Like

Hi Lee,

thank you. This was exactly what I was searching for!

Now I found something I’m wondering about. Sometimes the muscles stated in the comments are not the ones that are included in the calculation.

In the calculation of the hip abductor muscle force the Gluteus medius muscle force is stated twice and the Gluteus minimus is not included.

/* Hip Abductors
o Gluteus medius
o Gluteus minimus
o Sartorius
o Tensor fasciae latae

  AnyVar HipAbductorMuscleForce = MuscleForces.GluteusMedForce + MuscleForces.GluteusMedForce + MuscleForces.SartoriusForce + MuscleForces.TensorFasciaeForce;

In the statement for the hip extensor muscle activity the short head of the biceps femoris is included instead of the long head, despite the comment explaining earlier that only the long head is a hip extensor.

/* Hip extensors:
o Gluteus maximus
o Most of the hamstrings:
" Long head of biceps femoris, short head is not a hip extensor, only a knee flexor
" Semimembranosus muscle
" Semitendinosus muscle

  AnyFloat HipExtensorMuscleActivity = {MuscleActivity.GluteusMaxActivity, MuscleActivity.BicepsFemorisCaputBreveActivity, MuscleActivity.SemimembranosusActivity, MuscleActivity.SemitendinosusActivity};

Meanwhile in the knee flexor muscle activity the long head of the biceps femoris is included again but not the short head.

/* Knee flexors:
o hamstrings (also hip extensors):
" biceps femoris (short head does not extend hip)
" semimembranosus
" semitendinosus
o gastrocnemius (also plantar flexor as a calf muscle)
o gracilis (also hip flexor/adductor)
o sartorius (also hip flexor/abductor/lateral rotator)

  //      AnyVar KneeFlexorMuscleActivity = MuscleActivity.BicepsFemorisCaputLongActivity + MuscleActivity.GastrocActivity + MuscleActivity.GracilisActivity + MuscleActivity.SartoriusActivity;
  AnyFloat KneeFlexorMuscleActivity = {MuscleActivity.BicepsFemorisCaputLongActivity, MuscleActivity.GastrocActivity, MuscleActivity.GracilisActivity, MuscleActivity.SartoriusActivity};

Does this have a reason or are those typos?


Hi Johanna,

This is typos… thanks a lot for making us aware of this,
The error was also present in same objects for both activity and force

We have fixed it on AMMR beta

Best regards

Hi Søren,

I am glad I could help.


Thanks for your help Johanna (@JMichel). You can can get access to the Beta version of the model repository if you like.

The procedure is:

  1. Sign up/in on
  2. Goto to
  3. Create an issue to request access.


When you have access you can also download the AMMR beta. Either using the 'git' version control client or as ordinary zip file.

Hi Morten,

I’ve got the AMMR beta version now. Thank you for suggesting it.

I’ve got some other questions about the muscle group activities why I originally created this topic. Any advise would be greatly appreciated.

I am interested in the activity for the knee extensors. Is there a specific reason why there is no data for the knee extensor muscle activity in the selected output folder?

Can I recreate the graph similar to the other muscle group activity profiles by searching the muscle activity of the single knee extensor muscles in the Output.Right.Leg.Mus folder?
How can I unite the muscle activity of all parts of the muscle into one value? Do I just need to take the maximum value for each time step?

Kind regards,

1 Like

I was also looking for same issue. Thanks it helped! Hopefully it should work in my system.

Hi Johanna,

The knee extensor muscles could have been added, i do not see a specific reason for not doing that.

One way to get one number out would be to take the max value like this e.g.

AnyVar ModelEnvelope = max({ Main.Model.HumanModel.Right.Leg.Mus.GluteusMedius1.Activity,

Best regards

Hi Søren,

thank you for your opinion.

I calculated the muscle activity and muscle force of the knee extensors similar to the definition of the other muscle group forces and activities in RightLegSelectedOutput.any.

It worked fine for me so I’ll provide my code here in case others want to do something similar.

// Add Muscle Activity of Vasti muscle group to the Selected Output folder
AnySearchFun VastusLateralisActivityList= {
Search = “Main.HumanModel.BodyModel.Right.Leg.Mus.VastusLateralis*.Activity”;

AnySearchFun  VastusMedialisActivityList=  {
  Search = "Main.HumanModel.BodyModel.Right.Leg.Mus.VastusMedialis*.Activity";

AnySearchFun  VastusIntermediusActivityList=  {
  Search = "Main.HumanModel.BodyModel.Right.Leg.Mus.VastusIntermedius*.Activity";

AnyVar VastusLateralisActivity = max(VastusLateralisActivityList());
AnyVar VastusMedialisActivity = max(VastusMedialisActivityList());
AnyVar VastusIntermediusActivity = max(VastusIntermediusActivityList());  


// Add Knee extensor muscle activity to the Selected Output folder
Main.HumanModel.BodyModel.SelectedOutput.Right.Leg.Muscles =

/* Knee Extensors
o Vastus lateralis
o Vastus medius
o Vastus intermedius
o Rectus femoris

AnyFloat KneeExtensorMuscleActivity = {MuscleActivity.VastusLateralisActivity, MuscleActivity.VastusMedialisActivity,


// Add Vasti muscle forces to the Selected Output folder

AnySearchFun VastusLateralisForceList = {
Search = “Main.HumanModel.BodyModel.Right.Leg.Mus.VastusLateralis*.Fout”;
AnySearchFun VastusMedialisForceList = {
Search = “Main.HumanModel.BodyModel.Right.Leg.Mus.VastusMedialis*.Fout”;
AnySearchFun VastusIntermediusForceList = {
Search = “Main.HumanModel.BodyModel.Right.Leg.Mus.VastusIntermedius*.Fout”;

AnyVar VastusLateralisForce = sum(VastusLateralisForceList());
AnyVar VastusMedialisForce=sum(VastusMedialisForceList());  
AnyVar VastusIntermediusForce=sum(VastusIntermediusForceList());

// Add Knee Extensor muscle force to the Selected Output folder
    /*  Knee Extensors
o	Vastus lateralis
o	Vastus medius
o	Vastus intermedius
o	Rectus femoris

AnyVar KneeExtensorMuscleForce =
MuscleForces.VastusLateralisForce+ MuscleForces.VastusMedialisForce + MuscleForces.VastusIntermediusForce + MuscleForces.RectusFemorisForce;



Kind regards,


Hi Johanna,

Thanks a lot for sharing the script

Best regards

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.

Hi AnyBody,

I would like to ask if there is any specific reason that in the following script, the semitendinosus and semimembranosus muscle forces are not included in the summation for KneeFlexorMuscleForce? If the reason was to avoid double report of one muscle (once reported in the HipExtensorMuscleForce), why they are considered as hip extensors and not knee flexors?

      AnyVar HipExtensorMuscleForce = MuscleForces.GluteusMaxForce + MuscleForces.BicepsFemorisCaputBreveForce + MuscleForces.SemimembranosusForce + MuscleForces.SemitendinosusForce;
      /* Knee flexors:
      o	hamstrings (also hip extensors): 
      "	biceps femoris (short head does not extend hip)
      "	semimembranosus
      "	semitendinosus
      o	gastrocnemius (also plantar flexor as a calf muscle)
      o	gracilis (also hip flexor/adductor)
      o	sartorius (also hip flexor/abductor/lateral rotator)
      AnyVar KneeFlexorMuscleForce = MuscleForces.BicepsFemorisCaputLongForce + MuscleForces.GastrocForce + MuscleForces.GracilisForce + MuscleForces.SartoriusForce;

Best regards,

Hi Iman,

Sorry for the late reply, we have been hit by summer vacations here at the office.
It is indeed a bug you have found and we are sorry for any hiccups it might have caused.

I have made a fix for it which will be available in the next release. It adds both muscles to the KneeFlexor group.

If you want I can invite you to our AMMR beta program where you can get the fix now and review it. You are also welcome to submit improvements or changes should you have any.
If you are interested please let me know and if you have, send me your GitHub account name - then we will send you the invite.

Thank you once again for reporting this.

Best regards,
AnyBody Technology