Fix a discrepancy between the gear ratio of the motor arm used and the gear ratio recorded by software.
Value
An object of the same class(es) as the input (x
). The function
will multiply Position
by (1/GR) and multiply Force
by GR,
returning an object with new values in $Position
and $Force
.
Other columns and attributes are welcome and will simply be passed on
unchanged into the resulting object.
Details
The muscle_stim
object can be of any type, including
workloop
, twitch
, or tetanus
.
If you have manually constructed the object via as_muscle_stim()
,
the muscle_stim
object should have columns as follows: Position
: length change of the muscle; Force
: force
See also
analyze_workloop
,
read_analyze_wl
,
read_analyze_wl_dir
Other data transformations:
invert_position()
,
select_cycles()
Other workloop functions:
analyze_workloop()
,
get_wl_metadata()
,
invert_position()
,
read_analyze_wl_dir()
,
read_analyze_wl()
,
select_cycles()
,
summarize_wl_trials()
,
time_correct()
Other twitch functions:
invert_position()
,
isometric_timing()
Other tetanus functions:
invert_position()
Examples
library(workloopR)
# import the workloop.ddf file included in workloopR
wl_dat <-read_ddf(system.file("extdata", "workloop.ddf",
package = 'workloopR'),
phase_from_peak = TRUE)
# apply a gear ratio correction of 2
# this will multiply Force by 2 and divide Position by 2
wl_fixed <- fix_GR(wl_dat, GR = 2)
# quick check:
max(wl_fixed$Force) / max(wl_dat$Force) # 5592.578 / 2796.289 = 2
#> [1] 2
max(wl_fixed$Position) / max(wl_dat$Position) # 1.832262 / 3.664524 = 0.5
#> [1] 0.5