コード例 #1
0
import scone_recursive_parser as srp
import par_to_controller as ptc
import numpy as np

# import controller file to string
complex_controller = srp.controller_file_to_string(
    "../models/gait_controllers/cx_gait_controller.txt")
solLV_controller = srp.controller_file_to_string(
    "../models/gait_controllers/sp_gait_controller.txt")
geyer_controller = srp.controller_file_to_string(
    "../models/gait_controllers/geyer_gait_controller.txt")
geyer_solLV_controller = srp.controller_file_to_string(
    "../models/gait_controllers/geyer_solLV_gait_controller.txt")
geyer_couplings_controller = srp.controller_file_to_string(
    "../models/gait_controllers/geyer_couplings_gait_controller.txt")

# convert controller string to recursive dictionnary
cx_dict = srp.dict_recursive_split(complex_controller)
sp_dict = srp.dict_recursive_split(solLV_controller)
ge_dict = srp.dict_recursive_split(geyer_controller)
ge_solLV_dict = srp.dict_recursive_split(geyer_solLV_controller)
ge_couplings_dict = srp.dict_recursive_split(geyer_couplings_controller)

# convert controller string to recursive pandas Series
cx_series = srp.series_recursive_split(complex_controller)
sp_series = srp.series_recursive_split(solLV_controller)
ge_series = srp.series_recursive_split(geyer_controller)
ge_solLV_series = srp.series_recursive_split(geyer_solLV_controller)
ge_couplings_series = srp.series_recursive_split(geyer_couplings_controller)

# get, set then get value again of existant key
import scone_recursive_parser as srp
import par_to_controller as ptc
import numpy as np

# import controller file to string
controller = srp.controller_file_to_string("../models/gait_controllers/new_controller_TAV_GAS.txt")

# convert controller string to recursive dictionnary
dict = srp.dict_recursive_split(controller)

# convert controller string to recursive pandas Series
series = srp.series_recursive_split(controller)

""""# get, set then get value again of existant key
print(srp.get_key(series, "KV","Swing Landing", "soleus"))
srp.set_key(series, "KV", "99","Swing Landing", "soleus")
print(srp.get_key(series, "KV","Swing Landing", "soleus"))"""

# export series to scone files
#srp.series_to_scone_file(series,"../exports/new_TAV_GAS_srp_out.scone")

""""# get series of reflexes verifying certain states, a target muscle and a source muscle
found_by_states_target_source = srp.find_by_states_target_source(cx_series, "Swing, Landing", "soleus")
print(found_by_states_target_source.to_json(indent = 4))

found_by_states_target_source[1]['Selim'] = 'hello'

found_by_states_target_source = srp.find_by_states_target_source(cx_series, "Swing, Landing", "soleus")
print(found_by_states_target_source.to_json(indent = 4))"""

# apply par file to controller with new value ranges.