Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a documentation page(s) that show parameter values and figures for all bicycles and riders #112

Merged
merged 25 commits into from
Oct 31, 2024

Conversation

moorepants
Copy link
Owner

The idea would be to display all the parameter output values for bicycle and bicycles+riders and show the standard geometry and eigenvalue plots. This would then be an easy place to get info and numerical values for downstream use (without having to run the software).

sphinx-gallery might be a better choice than the matplotlib directive, as the latter can't display text output of a cell and we could make one file/page per bicycle.

@moorepants
Copy link
Owner Author

I made this script for the balance assist bike and it would be nice to output similar info for all the other bikes:

import pprint
import numpy as np
import matplotlib.pyplot as plt
import bicycleparameters as bp
from bicycleparameters.parameter_sets import Meijaard2007ParameterSet
from bicycleparameters.models import Meijaard2007Model


data_dir = "/home/moorepants/Data/bicycle-parameters"
v = np.linspace(0.0, 10.0, num=401)

bicycle = bp.Bicycle("Balanceassistv1", pathToData=data_dir,
                     forcePeriodCalc=True, forceRawCalc=True)
bicycle.save_parameters()

print(bicycle)
print('Bicycle short name:', bicycle.bicycleName)
print('Directory:', bicycle.directory)
pprint.pprint(bicycle.extras)
M, C1, K0, K2 = bicycle.canonical()
print('M:', M)
print('C1:', C1)
print('K0:', K0)
print('k2:', K2)
A, B = bicycle.state_space(3.2)
print('A:', A)
print('B:', B)
print(*bicycle.eig([1.0, 2.0]))


bicycle.plot_bicycle_geometry(show=False)
bicycle.plot_eigenvalues_vs_speed(v)
par = bp.io.remove_uncertainties(bicycle.parameters['Benchmark'])
par['v'] = 1.0
pprint.pprint(par)
par_set = Meijaard2007ParameterSet(par, False)
par_set.plot_all()
model = Meijaard2007Model(par_set)
model.plot_eigenvalue_parts(v=v)

bicycle.add_rider('Jason', reCalc=True)
bicycle.save_parameters()
print(bicycle)
bicycle.plot_bicycle_geometry(show=False)
par = bp.io.remove_uncertainties(bicycle.parameters['Benchmark'])
par['v'] = 1.0
pprint.pprint(par)
par_set = Meijaard2007ParameterSet(par, True)
par_set.plot_all()
model = Meijaard2007Model(par_set)
model.plot_eigenvalue_parts(v=v)

plt.show()

@moorepants
Copy link
Owner Author

This is good enough to be merged. The old examples can be made into new gallery examples in future PRs.

@moorepants moorepants merged commit ac0cd42 into master Oct 31, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant