Bicyclator 3.0.0 Documentation¶
bicyclator Package¶
main Module¶
Conventions:
- All lengths are measured in millimeters, unless noted otherwise
- All angles are measured in degrees, unless noted otherwise
-
class
bicyclator.main.
Bicycle
(name=None, head_tube_angle=None, fork_rake=None, crank_length=None, front_cogs=None, rear_cogs=None, front_wheel=None, rear_wheel=None)¶ Bases:
object
Represents a bicycle.
Attributes:
- name
- front_cogs: list of integers representing the number of teeth on
the cogs, e.g.
front_cogs = [28, 42]
- rear_cogs: list of integers representing the number of teeth on
the cogs, e.g.
rear_cogs = [10, 15, 20, 25, 30]
- head_tube_angle
- fork_rake
- front_wheel: a Wheel instance
- rear_wheel: a Wheel instance
-
copy
()¶ Return a copy of this Bicycle.
-
class
bicyclator.main.
Wheel
(name=None, bsd=None, erd=None, tire_width=None, diameter=None, center_to_flange=None, flange_diameter=None, spoke_hole_diameter=2.6, num_spokes=None, num_crosses=3, offset=0)¶ Bases:
object
Represents a bicycle wheel.
Attributes:
- name
- bsd: bead seat diameter, e.g. 684 for a 650b rim
- erd: effective rim diameter, e.g. 650 for a 650b rim
- tire_width
- diameter: diameter of the wheel with the tire on and inflated
- center_to_flange: dictionary of the form
{'left': 37.1, 'right': 20.9}
- flange_diameter: dictionary of the form
{'left': 45, 'right': 45}
- spoke_hole_diameter
- num_spokes
- num_crosses: number of crosses in spoke pattern, e.g. 3
- offset: for off-center rims
-
copy
()¶ Return a copy of this Wheel.
-
bicyclator.main.
approx_diameter
(wheel)¶ Return the approximate diameter of the given wheel, which is the bead seat diameter plus twice the tire width.
Assume the following wheel attributes are non-null and non-empty:
- bsd
- tire_width
Raise a
ValueError
, if that is not the case.EXAMPLES:
>>> w = Wheel(bsd=584, tire_width=42) >>> approx_diameter(w) 668
-
bicyclator.main.
cadence_to_speeds
(bicycle, cadence, digits=None)¶ Return speeds in kilometers per hour. Cadence is measured in hertz (revolutions/second).
Assume the following bicycle attributes are non-null and non-empty:
- front_cogs
- rear_cogs
- crank_length
- rear_wheel
Raise a
ValueError
, if that is not the case.EXAMPLES:
>>> w = Wheel(diameter=600) >>> b = Bicycle(front_cogs=[40], rear_cogs=[20, 30], crank_length=100, rear_wheel=w) >>> cadence_to_speeds(b, 2, digits=1) {(40, 30): 18.1, (40, 20): 27.1}
-
bicyclator.main.
check_attrs
(obj, *attrs)¶
-
bicyclator.main.
derailer_capacity
(bicycle)¶ Return the derailer capacity needed to accommodate the cog set on the given Bicycle object.
Assume the following bicycle attributes are non-null and non-empty:
- front_cogs
- rear_cogs
Raise a
ValueError
, if that is not the case.EXAMPLES:
>>> b = Bicycle(front_cogs=[26, 36], rear_cogs=[12, 18, 32]) >>> derailer_capacity(b) 30
-
bicyclator.main.
gain_ratios
(bicycle, digits=None)¶ Return the gain ratios for the given Bicycle object.
Assume the following bicycle attributes are non-null and non-empty:
- front_cogs
- rear_cogs
- crank_length
- rear_wheel
Raise a
ValueError
, if that is not the case.EXAMPLES:
>>> w = Wheel(diameter=600) >>> b = Bicycle(front_cogs=[40], rear_cogs=[20, 30], crank_length=100, rear_wheel=w) >>> gain_ratios(b, digits=1) {(40, 30): 4.0, (40, 20): 6.0}
REFERENCES:
- Bicycle Gearing from Wikipedia
-
bicyclator.main.
gear_ratios
(bicycle, digits=None)¶ Return the gear ratios for the given Bicycle object.
Assume the following bicycle attributes are non-null and non-empty:
- front_cogs
- rear_cogs
Raise a
ValueError
, if that is not the case.EXAMPLES:
>>> b = Bicycle(front_cogs=[40], rear_cogs=[20, 30]) >>> gear_ratios(b) {(40, 30): 1.3333333333333333, (40, 20): 2.0}
-
bicyclator.main.
num_skid_patches
(bicycle, ambidextrous=False)¶ Return a dictionary of the form (front cog, rear cog) -> number of skid patches made on the rear tire of a fixed gear bicycle with the given front cog and rear cog.
Assume the following bicycle attributes are non-null and non-empty:
- front_cogs
- rear_cogs
Raise a
ValueError
, if that is not the case.EXAMPLES:
>>> b = Bicycle(front_cogs=[50], rear_cogs=[25, 30]) >>> num_skid_patches(b, ambidextrous=False) {(50, 30): 3.0, (50, 25): 1.0} >>> num_skid_patches(b, ambidextrous=True) {(50, 30): 6.0, (50, 25): 1.0}
SKID PATCH THEOREM:
Let a/b be the ratio of the number of teeth on the front cog to the number of teeth on the rear cog written in lowest terms. Then
- For single-sided skidding, there are b skid patches.
- Ambidexterous skidding (skidding with either the left or right foot forward) doubles the number of skid patches if and only if a is odd.
REFERENCES:
- A Bike Forums post by user Fraction.
-
bicyclator.main.
speed_to_cadences
(bicycle, speed, digits=None)¶ Return cadences in hertz (revolutions per second). Speed is measured in kilometers per hour.
Assume the following bicycle attributes are non-null and non-empty:
- front_cogs
- rear_cogs
- crank_length
- rear_wheel
Raise a
ValueError
, if that is not the case.EXAMPLES:
>>> w = Wheel(diameter=600) >>> b = Bicycle(front_cogs=[40], rear_cogs=[20, 30], crank_length=100, rear_wheel=w) >>> speed_to_cadences(b, 18.1, digits=1) {(40, 30): 2.0, (40, 20): 1.3}
-
bicyclator.main.
spoke_length
(wheel, digits=None)¶ Return the left (nondrive side) and right (drive side) spoke lengths for the given wheel.
Assume the following bicycle attributes are non-null and non-empty:
- center_to_flange
- flange_diameter
- spoke_hole_diameter
- erd
- offset
- num_spokes
- num_crosses
Raise a
ValueError
, if that is not the case.EXAMPLES:
>>> w = Wheel(center_to_flange={'left': 37.1, 'right': 20.9}, flange_diameter={'left': 45, 'right': 45}, erd=560, spoke_hole_diameter=2.6, offset=3, num_spokes=36, num_crosses=3) >>> spoke_length(w, digits=1) {'right': 269.2, 'left': 270.3}
REFERENCES:
- Measurements for Spoke Length Calculations by John Allen
-
bicyclator.main.
trail
(bicycle, digits=None)¶ Return the tuple (trail, mechanical trail, wheel flop) for a bicycle with the given parameters.
Assume the following bicycle attributes are non-null and non-empty:
- head_tube_angle
- fork_rake
- front_wheel
Raise a
ValueError
, if that is not the case.EXAMPLES:
>>> w = Wheel(diameter=700) >>> b = Bicycle(head_tube_angle=73, fork_rake=64, front_wheel=w) >>> trail(b, digits=1) (40.1, 38.3, 11.2)
REFERENCES:
- Bicycle and Motorcycle Geometry from Wikipedia