Skip to content

Commit

Permalink
custom logging if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpagnon committed Jan 8, 2025
1 parent 7a01e7c commit 645d15f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
44 changes: 35 additions & 9 deletions Pose2Sim/Pose2Sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ def calibration(config=None):
config_dict.get("project").update({"project_dir":session_dir})

# Set up logging
setup_logging(session_dir)
use_custom_logging = config_dict.get('logging').get('use_custom_logging')
if not use_custom_logging:
setup_logging(session_dir)
currentDateAndTime = datetime.now()

# Run calibration
Expand Down Expand Up @@ -218,7 +220,10 @@ def poseEstimation(config=None):

# Set up logging
session_dir = os.path.realpath(os.path.join(config_dicts[0].get('project').get('project_dir'), '.'))
setup_logging(session_dir)
use_custom_logging = config_dict.get('logging').get('use_custom_logging')
if not use_custom_logging:
setup_logging(session_dir)
currentDateAndTime = datetime.now()

# Batch process all trials
for config_dict in config_dicts:
Expand Down Expand Up @@ -265,7 +270,10 @@ def synchronization(config=None):

# Set up logging
session_dir = os.path.realpath(os.path.join(config_dicts[0].get('project').get('project_dir'), '.'))
setup_logging(session_dir)
use_custom_logging = config_dict.get('logging').get('use_custom_logging')
if not use_custom_logging:
setup_logging(session_dir)
currentDateAndTime = datetime.now()

# Batch process all trials
for config_dict in config_dicts:
Expand Down Expand Up @@ -309,7 +317,10 @@ def personAssociation(config=None):

# Set up logging
session_dir = os.path.realpath(os.path.join(config_dicts[0].get('project').get('project_dir'), '.'))
setup_logging(session_dir)
use_custom_logging = config_dict.get('logging').get('use_custom_logging')
if not use_custom_logging:
setup_logging(session_dir)
currentDateAndTime = datetime.now()

# Batch process all trials
for config_dict in config_dicts:
Expand Down Expand Up @@ -355,7 +366,10 @@ def triangulation(config=None):

# Set up logging
session_dir = os.path.realpath(os.path.join(config_dicts[0].get('project').get('project_dir'), '.'))
setup_logging(session_dir)
use_custom_logging = config_dict.get('logging').get('use_custom_logging')
if not use_custom_logging:
setup_logging(session_dir)
currentDateAndTime = datetime.now()

# Batch process all trials
for config_dict in config_dicts:
Expand Down Expand Up @@ -401,7 +415,10 @@ def filtering(config=None):

# Set up logging
session_dir = os.path.realpath(os.path.join(config_dicts[0].get('project').get('project_dir'), '.'))
setup_logging(session_dir)
use_custom_logging = config_dict.get('logging').get('use_custom_logging')
if not use_custom_logging:
setup_logging(session_dir)
currentDateAndTime = datetime.now()

# Batch process all trials
for config_dict in config_dicts:
Expand Down Expand Up @@ -442,7 +459,10 @@ def markerAugmentation(config=None):
config_dict.get("project").update({"project_dir":"<YOUR_TRIAL_DIRECTORY>"})')

session_dir = os.path.realpath(os.path.join(config_dicts[0].get('project').get('project_dir'), '.'))
setup_logging(session_dir)
use_custom_logging = config_dict.get('logging').get('use_custom_logging')
if not use_custom_logging:
setup_logging(session_dir)
currentDateAndTime = datetime.now()

for config_dict in config_dicts:
start = time.time()
Expand Down Expand Up @@ -485,7 +505,10 @@ def kinematics(config=None):
config_dict.get("project").update({"project_dir":"<YOUR_TRIAL_DIRECTORY>"})')

session_dir = os.path.realpath(os.path.join(config_dicts[0].get('project').get('project_dir'), '.'))
setup_logging(session_dir)
use_custom_logging = config_dict.get('logging').get('use_custom_logging')
if not use_custom_logging:
setup_logging(session_dir)
currentDateAndTime = datetime.now()

# Process each configuration dictionary
for config_dict in config_dicts:
Expand Down Expand Up @@ -519,7 +542,10 @@ def runAll(config=None, do_calibration=True, do_poseEstimation=True, do_synchron
# Set up logging
level, config_dicts = read_config_files(config)
session_dir = os.path.realpath(os.path.join(config_dicts[0].get('project').get('project_dir'), '.'))
setup_logging(session_dir)
use_custom_logging = config_dicts[0].get('logging').get('use_custom_logging')
if not use_custom_logging:
setup_logging(session_dir)
currentDateAndTime = datetime.now()

currentDateAndTime = datetime.now()
start = time.time()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ All of them are clearly documented: feel free to play with them!
> _**Another person, hidden all along, will appear when multi-person analysis is activated!**_
Go to the Multi-participant Demo folder: `cd <path>\Pose2Sim\Demo_MultiPerson`. \
Make sure that `multi_person = true` is set in your [Config.toml](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Demo_MultiPerson/Config.toml) file.\
Type `ipython`, and try the following code:

``` python
Expand Down Expand Up @@ -274,7 +275,6 @@ You can visualize your results with Blender as explained in [Demonstration Part-
<br>

***N.B.:***
- In [Config.toml](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Demo_SinglePerson/Config.toml), set `project` > `multi_person = true` for each trial that contains multiple persons.
- Make sure that the order of `markerAugmentation` > `participant_height` and `participant_mass` matches the person's IDs.

<br/>
Expand Down

0 comments on commit 645d15f

Please sign in to comment.