repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
joferkington/mplstereonet
mplstereonet/utilities.py
parse_strike_dip
def parse_strike_dip(strike, dip): """ Parses strings of strike and dip and returns strike and dip measurements following the right-hand-rule. Dip directions are parsed, and if the measurement does not follow the right-hand-rule, the opposite end of the strike measurement is returned. Accepts ...
python
def parse_strike_dip(strike, dip): """ Parses strings of strike and dip and returns strike and dip measurements following the right-hand-rule. Dip directions are parsed, and if the measurement does not follow the right-hand-rule, the opposite end of the strike measurement is returned. Accepts ...
[ "def", "parse_strike_dip", "(", "strike", ",", "dip", ")", ":", "strike", "=", "parse_azimuth", "(", "strike", ")", "dip", ",", "direction", "=", "split_trailing_letters", "(", "dip", ")", "if", "direction", "is", "not", "None", ":", "expected_direc", "=", ...
Parses strings of strike and dip and returns strike and dip measurements following the right-hand-rule. Dip directions are parsed, and if the measurement does not follow the right-hand-rule, the opposite end of the strike measurement is returned. Accepts either quadrant-formatted or azimuth-formatted ...
[ "Parses", "strings", "of", "strike", "and", "dip", "and", "returns", "strike", "and", "dip", "measurements", "following", "the", "right", "-", "hand", "-", "rule", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/utilities.py#L5-L44
train
joferkington/mplstereonet
mplstereonet/utilities.py
parse_rake
def parse_rake(strike, dip, rake): """ Parses strings of strike, dip, and rake and returns a strike, dip, and rake measurement following the right-hand-rule, with the "end" of the strike that the rake is measured from indicated by the sign of the rake (positive rakes correspond to the strike directi...
python
def parse_rake(strike, dip, rake): """ Parses strings of strike, dip, and rake and returns a strike, dip, and rake measurement following the right-hand-rule, with the "end" of the strike that the rake is measured from indicated by the sign of the rake (positive rakes correspond to the strike directi...
[ "def", "parse_rake", "(", "strike", ",", "dip", ",", "rake", ")", ":", "strike", ",", "dip", "=", "parse_strike_dip", "(", "strike", ",", "dip", ")", "rake", ",", "direction", "=", "split_trailing_letters", "(", "rake", ")", "if", "direction", "is", "not...
Parses strings of strike, dip, and rake and returns a strike, dip, and rake measurement following the right-hand-rule, with the "end" of the strike that the rake is measured from indicated by the sign of the rake (positive rakes correspond to the strike direction, negative rakes correspond to the opposi...
[ "Parses", "strings", "of", "strike", "dip", "and", "rake", "and", "returns", "a", "strike", "dip", "and", "rake", "measurement", "following", "the", "right", "-", "hand", "-", "rule", "with", "the", "end", "of", "the", "strike", "that", "the", "rake", "i...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/utilities.py#L46-L91
train
joferkington/mplstereonet
mplstereonet/utilities.py
parse_plunge_bearing
def parse_plunge_bearing(plunge, bearing): """ Parses strings of plunge and bearing and returns a consistent plunge and bearing measurement as floats. Plunge angles returned by this function will always be between 0 and 90. If no direction letter(s) is present, the plunge is assumed to be measured ...
python
def parse_plunge_bearing(plunge, bearing): """ Parses strings of plunge and bearing and returns a consistent plunge and bearing measurement as floats. Plunge angles returned by this function will always be between 0 and 90. If no direction letter(s) is present, the plunge is assumed to be measured ...
[ "def", "parse_plunge_bearing", "(", "plunge", ",", "bearing", ")", ":", "bearing", "=", "parse_azimuth", "(", "bearing", ")", "plunge", ",", "direction", "=", "split_trailing_letters", "(", "plunge", ")", "if", "direction", "is", "not", "None", ":", "if", "o...
Parses strings of plunge and bearing and returns a consistent plunge and bearing measurement as floats. Plunge angles returned by this function will always be between 0 and 90. If no direction letter(s) is present, the plunge is assumed to be measured from the end specified by the bearing. If a directi...
[ "Parses", "strings", "of", "plunge", "and", "bearing", "and", "returns", "a", "consistent", "plunge", "and", "bearing", "measurement", "as", "floats", ".", "Plunge", "angles", "returned", "by", "this", "function", "will", "always", "be", "between", "0", "and",...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/utilities.py#L93-L141
train
joferkington/mplstereonet
mplstereonet/utilities.py
dip_direction2strike
def dip_direction2strike(azimuth): """ Converts a planar measurment of dip direction using the dip-azimuth convention into a strike using the right-hand-rule. Parameters ---------- azimuth : number or string The dip direction of the plane in degrees. This can be either a numeric...
python
def dip_direction2strike(azimuth): """ Converts a planar measurment of dip direction using the dip-azimuth convention into a strike using the right-hand-rule. Parameters ---------- azimuth : number or string The dip direction of the plane in degrees. This can be either a numeric...
[ "def", "dip_direction2strike", "(", "azimuth", ")", ":", "azimuth", "=", "parse_azimuth", "(", "azimuth", ")", "strike", "=", "azimuth", "-", "90", "if", "strike", "<", "0", ":", "strike", "+=", "360", "return", "strike" ]
Converts a planar measurment of dip direction using the dip-azimuth convention into a strike using the right-hand-rule. Parameters ---------- azimuth : number or string The dip direction of the plane in degrees. This can be either a numerical azimuth in the 0-360 range or a string repre...
[ "Converts", "a", "planar", "measurment", "of", "dip", "direction", "using", "the", "dip", "-", "azimuth", "convention", "into", "a", "strike", "using", "the", "right", "-", "hand", "-", "rule", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/utilities.py#L143-L164
train
joferkington/mplstereonet
mplstereonet/utilities.py
strike2dip_direction
def strike2dip_direction(strike): """ Converts a planar measurement of strike using the right-hand-rule into the dip direction (i.e. the direction that the plane dips). Parameters ---------- strike : number or string The strike direction of the plane in degrees. This can be either a ...
python
def strike2dip_direction(strike): """ Converts a planar measurement of strike using the right-hand-rule into the dip direction (i.e. the direction that the plane dips). Parameters ---------- strike : number or string The strike direction of the plane in degrees. This can be either a ...
[ "def", "strike2dip_direction", "(", "strike", ")", ":", "strike", "=", "parse_azimuth", "(", "strike", ")", "dip_direction", "=", "strike", "+", "90", "if", "dip_direction", ">", "360", ":", "dip_direction", "-=", "360", "return", "dip_direction" ]
Converts a planar measurement of strike using the right-hand-rule into the dip direction (i.e. the direction that the plane dips). Parameters ---------- strike : number or string The strike direction of the plane in degrees. This can be either a numerical azimuth in the 0-360 range or a...
[ "Converts", "a", "planar", "measurement", "of", "strike", "using", "the", "right", "-", "hand", "-", "rule", "into", "the", "dip", "direction", "(", "i", ".", "e", ".", "the", "direction", "that", "the", "plane", "dips", ")", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/utilities.py#L166-L187
train
joferkington/mplstereonet
mplstereonet/utilities.py
parse_azimuth
def parse_azimuth(azimuth): """ Parses an azimuth measurement in azimuth or quadrant format. Parameters ----------- azimuth : string or number An azimuth measurement in degrees or a quadrant measurement of azimuth. Returns ------- azi : float The azimuth in degrees cloc...
python
def parse_azimuth(azimuth): """ Parses an azimuth measurement in azimuth or quadrant format. Parameters ----------- azimuth : string or number An azimuth measurement in degrees or a quadrant measurement of azimuth. Returns ------- azi : float The azimuth in degrees cloc...
[ "def", "parse_azimuth", "(", "azimuth", ")", ":", "try", ":", "azimuth", "=", "float", "(", "azimuth", ")", "except", "ValueError", ":", "if", "not", "azimuth", "[", "0", "]", ".", "isalpha", "(", ")", ":", "raise", "ValueError", "(", "'Ambiguous azimuth...
Parses an azimuth measurement in azimuth or quadrant format. Parameters ----------- azimuth : string or number An azimuth measurement in degrees or a quadrant measurement of azimuth. Returns ------- azi : float The azimuth in degrees clockwise from north (range: 0-360) See...
[ "Parses", "an", "azimuth", "measurement", "in", "azimuth", "or", "quadrant", "format", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/utilities.py#L223-L249
train
joferkington/mplstereonet
mplstereonet/utilities.py
parse_quadrant_measurement
def parse_quadrant_measurement(quad_azimuth): """ Parses a quadrant measurement of the form "AxxB", where A and B are cardinal directions and xx is an angle measured relative to those directions. In other words, it converts a measurement such as E30N into an azimuth of 60 degrees, or W10S into an a...
python
def parse_quadrant_measurement(quad_azimuth): """ Parses a quadrant measurement of the form "AxxB", where A and B are cardinal directions and xx is an angle measured relative to those directions. In other words, it converts a measurement such as E30N into an azimuth of 60 degrees, or W10S into an a...
[ "def", "parse_quadrant_measurement", "(", "quad_azimuth", ")", ":", "def", "rotation_direction", "(", "first", ",", "second", ")", ":", "return", "np", ".", "cross", "(", "_azimuth2vec", "(", "first", ")", ",", "_azimuth2vec", "(", "second", ")", ")", "# Par...
Parses a quadrant measurement of the form "AxxB", where A and B are cardinal directions and xx is an angle measured relative to those directions. In other words, it converts a measurement such as E30N into an azimuth of 60 degrees, or W10S into an azimuth of 260 degrees. For ambiguous quadrant measure...
[ "Parses", "a", "quadrant", "measurement", "of", "the", "form", "AxxB", "where", "A", "and", "B", "are", "cardinal", "directions", "and", "xx", "is", "an", "angle", "measured", "relative", "to", "those", "directions", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/utilities.py#L251-L302
train
joferkington/mplstereonet
mplstereonet/stereonet_transforms.py
BaseStereonetTransform.inverted
def inverted(self): """Return the inverse of the transform.""" # This is a bit of hackery so that we can put a single "inverse" # function here. If we just made "self._inverse_type" point to the class # in question, it wouldn't be defined yet. This way, it's done at # at runtime ...
python
def inverted(self): """Return the inverse of the transform.""" # This is a bit of hackery so that we can put a single "inverse" # function here. If we just made "self._inverse_type" point to the class # in question, it wouldn't be defined yet. This way, it's done at # at runtime ...
[ "def", "inverted", "(", "self", ")", ":", "# This is a bit of hackery so that we can put a single \"inverse\"", "# function here. If we just made \"self._inverse_type\" point to the class", "# in question, it wouldn't be defined yet. This way, it's done at", "# at runtime and we avoid the definiti...
Return the inverse of the transform.
[ "Return", "the", "inverse", "of", "the", "transform", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_transforms.py#L54-L64
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
sph2cart
def sph2cart(lon, lat): """ Converts a longitude and latitude (or sequence of lons and lats) given in _radians_ to cartesian coordinates, `x`, `y`, `z`, where x=0, y=0, z=0 is the center of the globe. Parameters ---------- lon : array-like Longitude in radians lat : array-like ...
python
def sph2cart(lon, lat): """ Converts a longitude and latitude (or sequence of lons and lats) given in _radians_ to cartesian coordinates, `x`, `y`, `z`, where x=0, y=0, z=0 is the center of the globe. Parameters ---------- lon : array-like Longitude in radians lat : array-like ...
[ "def", "sph2cart", "(", "lon", ",", "lat", ")", ":", "x", "=", "np", ".", "cos", "(", "lat", ")", "*", "np", ".", "cos", "(", "lon", ")", "y", "=", "np", ".", "cos", "(", "lat", ")", "*", "np", ".", "sin", "(", "lon", ")", "z", "=", "np...
Converts a longitude and latitude (or sequence of lons and lats) given in _radians_ to cartesian coordinates, `x`, `y`, `z`, where x=0, y=0, z=0 is the center of the globe. Parameters ---------- lon : array-like Longitude in radians lat : array-like Latitude in radians Retu...
[ "Converts", "a", "longitude", "and", "latitude", "(", "or", "sequence", "of", "lons", "and", "lats", ")", "given", "in", "_radians_", "to", "cartesian", "coordinates", "x", "y", "z", "where", "x", "=", "0", "y", "=", "0", "z", "=", "0", "is", "the", ...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L28-L48
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
cart2sph
def cart2sph(x, y, z): """ Converts cartesian coordinates `x`, `y`, `z` into a longitude and latitude. x=0, y=0, z=0 is assumed to correspond to the center of the globe. Returns lon and lat in radians. Parameters ---------- `x`, `y`, `z` : Arrays of cartesian coordinates Returns --...
python
def cart2sph(x, y, z): """ Converts cartesian coordinates `x`, `y`, `z` into a longitude and latitude. x=0, y=0, z=0 is assumed to correspond to the center of the globe. Returns lon and lat in radians. Parameters ---------- `x`, `y`, `z` : Arrays of cartesian coordinates Returns --...
[ "def", "cart2sph", "(", "x", ",", "y", ",", "z", ")", ":", "r", "=", "np", ".", "sqrt", "(", "x", "**", "2", "+", "y", "**", "2", "+", "z", "**", "2", ")", "lat", "=", "np", ".", "arcsin", "(", "z", "/", "r", ")", "lon", "=", "np", "....
Converts cartesian coordinates `x`, `y`, `z` into a longitude and latitude. x=0, y=0, z=0 is assumed to correspond to the center of the globe. Returns lon and lat in radians. Parameters ---------- `x`, `y`, `z` : Arrays of cartesian coordinates Returns ------- lon : Longitude in radian...
[ "Converts", "cartesian", "coordinates", "x", "y", "z", "into", "a", "longitude", "and", "latitude", ".", "x", "=", "0", "y", "=", "0", "z", "=", "0", "is", "assumed", "to", "correspond", "to", "the", "center", "of", "the", "globe", ".", "Returns", "l...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L50-L68
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
_rotate
def _rotate(lon, lat, theta, axis='x'): """ Rotate "lon", "lat" coords (in _degrees_) about the X-axis by "theta" degrees. This effectively simulates rotating a physical stereonet. Returns rotated lon, lat coords in _radians_). """ # Convert input to numpy arrays in radians lon, lat = np.at...
python
def _rotate(lon, lat, theta, axis='x'): """ Rotate "lon", "lat" coords (in _degrees_) about the X-axis by "theta" degrees. This effectively simulates rotating a physical stereonet. Returns rotated lon, lat coords in _radians_). """ # Convert input to numpy arrays in radians lon, lat = np.at...
[ "def", "_rotate", "(", "lon", ",", "lat", ",", "theta", ",", "axis", "=", "'x'", ")", ":", "# Convert input to numpy arrays in radians", "lon", ",", "lat", "=", "np", ".", "atleast_1d", "(", "lon", ",", "lat", ")", "lon", ",", "lat", "=", "map", "(", ...
Rotate "lon", "lat" coords (in _degrees_) about the X-axis by "theta" degrees. This effectively simulates rotating a physical stereonet. Returns rotated lon, lat coords in _radians_).
[ "Rotate", "lon", "lat", "coords", "(", "in", "_degrees_", ")", "about", "the", "X", "-", "axis", "by", "theta", "degrees", ".", "This", "effectively", "simulates", "rotating", "a", "physical", "stereonet", ".", "Returns", "rotated", "lon", "lat", "coords", ...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L70-L89
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
antipode
def antipode(lon, lat): """ Calculates the antipode (opposite point on the globe) of the given point or points. Input and output is expected to be in radians. Parameters ---------- lon : number or sequence of numbers Longitude in radians lat : number or sequence of numbers L...
python
def antipode(lon, lat): """ Calculates the antipode (opposite point on the globe) of the given point or points. Input and output is expected to be in radians. Parameters ---------- lon : number or sequence of numbers Longitude in radians lat : number or sequence of numbers L...
[ "def", "antipode", "(", "lon", ",", "lat", ")", ":", "x", ",", "y", ",", "z", "=", "sph2cart", "(", "lon", ",", "lat", ")", "return", "cart2sph", "(", "-", "x", ",", "-", "y", ",", "-", "z", ")" ]
Calculates the antipode (opposite point on the globe) of the given point or points. Input and output is expected to be in radians. Parameters ---------- lon : number or sequence of numbers Longitude in radians lat : number or sequence of numbers Latitude in radians Returns ...
[ "Calculates", "the", "antipode", "(", "opposite", "point", "on", "the", "globe", ")", "of", "the", "given", "point", "or", "points", ".", "Input", "and", "output", "is", "expected", "to", "be", "in", "radians", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L109-L128
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
plane
def plane(strike, dip, segments=100, center=(0, 0)): """ Calculates the longitude and latitude of `segments` points along the stereonet projection of each plane with a given `strike` and `dip` in degrees. Returns points for one hemisphere only. Parameters ---------- strike : number or sequ...
python
def plane(strike, dip, segments=100, center=(0, 0)): """ Calculates the longitude and latitude of `segments` points along the stereonet projection of each plane with a given `strike` and `dip` in degrees. Returns points for one hemisphere only. Parameters ---------- strike : number or sequ...
[ "def", "plane", "(", "strike", ",", "dip", ",", "segments", "=", "100", ",", "center", "=", "(", "0", ",", "0", ")", ")", ":", "lon0", ",", "lat0", "=", "center", "strikes", ",", "dips", "=", "np", ".", "atleast_1d", "(", "strike", ",", "dip", ...
Calculates the longitude and latitude of `segments` points along the stereonet projection of each plane with a given `strike` and `dip` in degrees. Returns points for one hemisphere only. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, wi...
[ "Calculates", "the", "longitude", "and", "latitude", "of", "segments", "points", "along", "the", "stereonet", "projection", "of", "each", "plane", "with", "a", "given", "strike", "and", "dip", "in", "degrees", ".", "Returns", "points", "for", "one", "hemispher...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L130-L181
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
pole
def pole(strike, dip): """ Calculates the longitude and latitude of the pole(s) to the plane(s) specified by `strike` and `dip`, given in degrees. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, with dip direction indicated by ...
python
def pole(strike, dip): """ Calculates the longitude and latitude of the pole(s) to the plane(s) specified by `strike` and `dip`, given in degrees. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, with dip direction indicated by ...
[ "def", "pole", "(", "strike", ",", "dip", ")", ":", "strike", ",", "dip", "=", "np", ".", "atleast_1d", "(", "strike", ",", "dip", ")", "mask", "=", "dip", ">", "90", "dip", "[", "mask", "]", "=", "180", "-", "dip", "[", "mask", "]", "strike", ...
Calculates the longitude and latitude of the pole(s) to the plane(s) specified by `strike` and `dip`, given in degrees. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, with dip direction indicated by the azimuth (e.g. 315 vs. 135) spec...
[ "Calculates", "the", "longitude", "and", "latitude", "of", "the", "pole", "(", "s", ")", "to", "the", "plane", "(", "s", ")", "specified", "by", "strike", "and", "dip", "given", "in", "degrees", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L183-L208
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
rake
def rake(strike, dip, rake_angle): """ Calculates the longitude and latitude of the linear feature(s) specified by `strike`, `dip`, and `rake_angle`. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, with dip direction indicated by ...
python
def rake(strike, dip, rake_angle): """ Calculates the longitude and latitude of the linear feature(s) specified by `strike`, `dip`, and `rake_angle`. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, with dip direction indicated by ...
[ "def", "rake", "(", "strike", ",", "dip", ",", "rake_angle", ")", ":", "strike", ",", "dip", ",", "rake_angle", "=", "np", ".", "atleast_1d", "(", "strike", ",", "dip", ",", "rake_angle", ")", "# Plot the approriate point for a strike of 0 and rotate it", "dip",...
Calculates the longitude and latitude of the linear feature(s) specified by `strike`, `dip`, and `rake_angle`. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, with dip direction indicated by the azimuth (e.g. 315 vs. 135) specified fol...
[ "Calculates", "the", "longitude", "and", "latitude", "of", "the", "linear", "feature", "(", "s", ")", "specified", "by", "strike", "dip", "and", "rake_angle", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L210-L243
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
line
def line(plunge, bearing): """ Calculates the longitude and latitude of the linear feature(s) specified by `plunge` and `bearing`. Parameters ---------- plunge : number or sequence of numbers The plunge of the line(s) in degrees. The plunge is measured in degrees downward from t...
python
def line(plunge, bearing): """ Calculates the longitude and latitude of the linear feature(s) specified by `plunge` and `bearing`. Parameters ---------- plunge : number or sequence of numbers The plunge of the line(s) in degrees. The plunge is measured in degrees downward from t...
[ "def", "line", "(", "plunge", ",", "bearing", ")", ":", "plunge", ",", "bearing", "=", "np", ".", "atleast_1d", "(", "plunge", ",", "bearing", ")", "# Plot the approriate point for a bearing of 0 and rotate it", "lat", "=", "90", "-", "plunge", "lon", "=", "0"...
Calculates the longitude and latitude of the linear feature(s) specified by `plunge` and `bearing`. Parameters ---------- plunge : number or sequence of numbers The plunge of the line(s) in degrees. The plunge is measured in degrees downward from the end of the feature specified by the ...
[ "Calculates", "the", "longitude", "and", "latitude", "of", "the", "linear", "feature", "(", "s", ")", "specified", "by", "plunge", "and", "bearing", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L245-L267
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
cone
def cone(plunge, bearing, angle, segments=100): """ Calculates the longitude and latitude of the small circle (i.e. a cone) centered at the given *plunge* and *bearing* with an apical angle of *angle*, all in degrees. Parameters ---------- plunge : number or sequence of numbers The ...
python
def cone(plunge, bearing, angle, segments=100): """ Calculates the longitude and latitude of the small circle (i.e. a cone) centered at the given *plunge* and *bearing* with an apical angle of *angle*, all in degrees. Parameters ---------- plunge : number or sequence of numbers The ...
[ "def", "cone", "(", "plunge", ",", "bearing", ",", "angle", ",", "segments", "=", "100", ")", ":", "plunges", ",", "bearings", ",", "angles", "=", "np", ".", "atleast_1d", "(", "plunge", ",", "bearing", ",", "angle", ")", "lons", ",", "lats", "=", ...
Calculates the longitude and latitude of the small circle (i.e. a cone) centered at the given *plunge* and *bearing* with an apical angle of *angle*, all in degrees. Parameters ---------- plunge : number or sequence of numbers The plunge of the center of the cone(s) in degrees. The plunge i...
[ "Calculates", "the", "longitude", "and", "latitude", "of", "the", "small", "circle", "(", "i", ".", "e", ".", "a", "cone", ")", "centered", "at", "the", "given", "*", "plunge", "*", "and", "*", "bearing", "*", "with", "an", "apical", "angle", "of", "...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L269-L303
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
plunge_bearing2pole
def plunge_bearing2pole(plunge, bearing): """ Converts the given `plunge` and `bearing` in degrees to a strike and dip of the plane whose pole would be parallel to the line specified. (i.e. The pole to the plane returned would plot at the same point as the specified plunge and bearing.) Paramet...
python
def plunge_bearing2pole(plunge, bearing): """ Converts the given `plunge` and `bearing` in degrees to a strike and dip of the plane whose pole would be parallel to the line specified. (i.e. The pole to the plane returned would plot at the same point as the specified plunge and bearing.) Paramet...
[ "def", "plunge_bearing2pole", "(", "plunge", ",", "bearing", ")", ":", "plunge", ",", "bearing", "=", "np", ".", "atleast_1d", "(", "plunge", ",", "bearing", ")", "strike", "=", "bearing", "+", "90", "dip", "=", "90", "-", "plunge", "strike", "[", "str...
Converts the given `plunge` and `bearing` in degrees to a strike and dip of the plane whose pole would be parallel to the line specified. (i.e. The pole to the plane returned would plot at the same point as the specified plunge and bearing.) Parameters ---------- plunge : number or sequence of ...
[ "Converts", "the", "given", "plunge", "and", "bearing", "in", "degrees", "to", "a", "strike", "and", "dip", "of", "the", "plane", "whose", "pole", "would", "be", "parallel", "to", "the", "line", "specified", ".", "(", "i", ".", "e", ".", "The", "pole",...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L305-L329
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
pole2plunge_bearing
def pole2plunge_bearing(strike, dip): """ Converts the given *strike* and *dip* in dgrees of a plane(s) to a plunge and bearing of its pole. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, with dip direction indicated by the az...
python
def pole2plunge_bearing(strike, dip): """ Converts the given *strike* and *dip* in dgrees of a plane(s) to a plunge and bearing of its pole. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, with dip direction indicated by the az...
[ "def", "pole2plunge_bearing", "(", "strike", ",", "dip", ")", ":", "strike", ",", "dip", "=", "np", ".", "atleast_1d", "(", "strike", ",", "dip", ")", "bearing", "=", "strike", "-", "90", "plunge", "=", "90", "-", "dip", "bearing", "[", "bearing", "<...
Converts the given *strike* and *dip* in dgrees of a plane(s) to a plunge and bearing of its pole. Parameters ---------- strike : number or sequence of numbers The strike of the plane(s) in degrees, with dip direction indicated by the azimuth (e.g. 315 vs. 135) specified following the "...
[ "Converts", "the", "given", "*", "strike", "*", "and", "*", "dip", "*", "in", "dgrees", "of", "a", "plane", "(", "s", ")", "to", "a", "plunge", "and", "bearing", "of", "its", "pole", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L331-L354
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
mean_vector
def mean_vector(lons, lats): """ Returns the resultant vector from a series of longitudes and latitudes Parameters ---------- lons : array-like A sequence of longitudes (in radians) lats : array-like A sequence of latitudes (in radians) Returns ------- mean_vec : tu...
python
def mean_vector(lons, lats): """ Returns the resultant vector from a series of longitudes and latitudes Parameters ---------- lons : array-like A sequence of longitudes (in radians) lats : array-like A sequence of latitudes (in radians) Returns ------- mean_vec : tu...
[ "def", "mean_vector", "(", "lons", ",", "lats", ")", ":", "xyz", "=", "sph2cart", "(", "lons", ",", "lats", ")", "xyz", "=", "np", ".", "vstack", "(", "xyz", ")", ".", "T", "mean_vec", "=", "xyz", ".", "mean", "(", "axis", "=", "0", ")", "r_val...
Returns the resultant vector from a series of longitudes and latitudes Parameters ---------- lons : array-like A sequence of longitudes (in radians) lats : array-like A sequence of latitudes (in radians) Returns ------- mean_vec : tuple (lon, lat) in radians r_v...
[ "Returns", "the", "resultant", "vector", "from", "a", "series", "of", "longitudes", "and", "latitudes" ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L356-L380
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
fisher_stats
def fisher_stats(lons, lats, conf=95): """ Returns the resultant vector from a series of longitudes and latitudes. If a confidence is set the function additionally returns the opening angle of the confidence small circle (Fisher, 19..) and the dispersion factor (kappa). Parameters ---------...
python
def fisher_stats(lons, lats, conf=95): """ Returns the resultant vector from a series of longitudes and latitudes. If a confidence is set the function additionally returns the opening angle of the confidence small circle (Fisher, 19..) and the dispersion factor (kappa). Parameters ---------...
[ "def", "fisher_stats", "(", "lons", ",", "lats", ",", "conf", "=", "95", ")", ":", "xyz", "=", "sph2cart", "(", "lons", ",", "lats", ")", "xyz", "=", "np", ".", "vstack", "(", "xyz", ")", ".", "T", "mean_vec", "=", "xyz", ".", "mean", "(", "axi...
Returns the resultant vector from a series of longitudes and latitudes. If a confidence is set the function additionally returns the opening angle of the confidence small circle (Fisher, 19..) and the dispersion factor (kappa). Parameters ---------- lons : array-like A sequence of longi...
[ "Returns", "the", "resultant", "vector", "from", "a", "series", "of", "longitudes", "and", "latitudes", ".", "If", "a", "confidence", "is", "set", "the", "function", "additionally", "returns", "the", "opening", "angle", "of", "the", "confidence", "small", "cir...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L382-L437
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
geographic2pole
def geographic2pole(lon, lat): """ Converts a longitude and latitude (from a stereonet) into the strike and dip of the plane whose pole lies at the given longitude(s) and latitude(s). Parameters ---------- lon : array-like A sequence of longitudes (or a single longitude) in radians ...
python
def geographic2pole(lon, lat): """ Converts a longitude and latitude (from a stereonet) into the strike and dip of the plane whose pole lies at the given longitude(s) and latitude(s). Parameters ---------- lon : array-like A sequence of longitudes (or a single longitude) in radians ...
[ "def", "geographic2pole", "(", "lon", ",", "lat", ")", ":", "plunge", ",", "bearing", "=", "geographic2plunge_bearing", "(", "lon", ",", "lat", ")", "strike", "=", "bearing", "+", "90", "strike", "[", "strike", ">=", "360", "]", "-=", "360", "dip", "="...
Converts a longitude and latitude (from a stereonet) into the strike and dip of the plane whose pole lies at the given longitude(s) and latitude(s). Parameters ---------- lon : array-like A sequence of longitudes (or a single longitude) in radians lat : array-like A sequence of lati...
[ "Converts", "a", "longitude", "and", "latitude", "(", "from", "a", "stereonet", ")", "into", "the", "strike", "and", "dip", "of", "the", "plane", "whose", "pole", "lies", "at", "the", "given", "longitude", "(", "s", ")", "and", "latitude", "(", "s", ")...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L439-L462
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
geographic2plunge_bearing
def geographic2plunge_bearing(lon, lat): """ Converts longitude and latitude in stereonet coordinates into a plunge/bearing. Parameters ---------- lon, lat : numbers or sequences of numbers Longitudes and latitudes in radians as measured from a lower-hemisphere stereonet Re...
python
def geographic2plunge_bearing(lon, lat): """ Converts longitude and latitude in stereonet coordinates into a plunge/bearing. Parameters ---------- lon, lat : numbers or sequences of numbers Longitudes and latitudes in radians as measured from a lower-hemisphere stereonet Re...
[ "def", "geographic2plunge_bearing", "(", "lon", ",", "lat", ")", ":", "lon", ",", "lat", "=", "np", ".", "atleast_1d", "(", "lon", ",", "lat", ")", "x", ",", "y", ",", "z", "=", "sph2cart", "(", "lon", ",", "lat", ")", "# Bearing will be in the y-z pla...
Converts longitude and latitude in stereonet coordinates into a plunge/bearing. Parameters ---------- lon, lat : numbers or sequences of numbers Longitudes and latitudes in radians as measured from a lower-hemisphere stereonet Returns ------- plunge : array The plun...
[ "Converts", "longitude", "and", "latitude", "in", "stereonet", "coordinates", "into", "a", "plunge", "/", "bearing", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L464-L504
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
plane_intersection
def plane_intersection(strike1, dip1, strike2, dip2): """ Finds the intersection of two planes. Returns a plunge/bearing of the linear intersection of the two planes. Also accepts sequences of strike1s, dip1s, strike2s, dip2s. Parameters ---------- strike1, dip1 : numbers or sequences of n...
python
def plane_intersection(strike1, dip1, strike2, dip2): """ Finds the intersection of two planes. Returns a plunge/bearing of the linear intersection of the two planes. Also accepts sequences of strike1s, dip1s, strike2s, dip2s. Parameters ---------- strike1, dip1 : numbers or sequences of n...
[ "def", "plane_intersection", "(", "strike1", ",", "dip1", ",", "strike2", ",", "dip2", ")", ":", "norm1", "=", "sph2cart", "(", "*", "pole", "(", "strike1", ",", "dip1", ")", ")", "norm2", "=", "sph2cart", "(", "*", "pole", "(", "strike2", ",", "dip2...
Finds the intersection of two planes. Returns a plunge/bearing of the linear intersection of the two planes. Also accepts sequences of strike1s, dip1s, strike2s, dip2s. Parameters ---------- strike1, dip1 : numbers or sequences of numbers The strike and dip (in degrees, following the right...
[ "Finds", "the", "intersection", "of", "two", "planes", ".", "Returns", "a", "plunge", "/", "bearing", "of", "the", "linear", "intersection", "of", "the", "two", "planes", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L506-L532
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
project_onto_plane
def project_onto_plane(strike, dip, plunge, bearing): """ Projects a linear feature(s) onto the surface of a plane. Returns a rake angle(s) along the plane. This is also useful for finding the rake angle of a feature that already intersects the plane in question. Parameters ---------- ...
python
def project_onto_plane(strike, dip, plunge, bearing): """ Projects a linear feature(s) onto the surface of a plane. Returns a rake angle(s) along the plane. This is also useful for finding the rake angle of a feature that already intersects the plane in question. Parameters ---------- ...
[ "def", "project_onto_plane", "(", "strike", ",", "dip", ",", "plunge", ",", "bearing", ")", ":", "# Project the line onto the plane", "norm", "=", "sph2cart", "(", "*", "pole", "(", "strike", ",", "dip", ")", ")", "feature", "=", "sph2cart", "(", "*", "lin...
Projects a linear feature(s) onto the surface of a plane. Returns a rake angle(s) along the plane. This is also useful for finding the rake angle of a feature that already intersects the plane in question. Parameters ---------- strike, dip : numbers or sequences of numbers The strike a...
[ "Projects", "a", "linear", "feature", "(", "s", ")", "onto", "the", "surface", "of", "a", "plane", ".", "Returns", "a", "rake", "angle", "(", "s", ")", "along", "the", "plane", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L534-L578
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
azimuth2rake
def azimuth2rake(strike, dip, azimuth): """ Projects an azimuth of a linear feature onto a plane as a rake angle. Parameters ---------- strike, dip : numbers The strike and dip of the plane in degrees following the right-hand-rule. azimuth : numbers The azimuth of the li...
python
def azimuth2rake(strike, dip, azimuth): """ Projects an azimuth of a linear feature onto a plane as a rake angle. Parameters ---------- strike, dip : numbers The strike and dip of the plane in degrees following the right-hand-rule. azimuth : numbers The azimuth of the li...
[ "def", "azimuth2rake", "(", "strike", ",", "dip", ",", "azimuth", ")", ":", "plunge", ",", "bearing", "=", "plane_intersection", "(", "strike", ",", "dip", ",", "azimuth", ",", "90", ")", "rake", "=", "project_onto_plane", "(", "strike", ",", "dip", ",",...
Projects an azimuth of a linear feature onto a plane as a rake angle. Parameters ---------- strike, dip : numbers The strike and dip of the plane in degrees following the right-hand-rule. azimuth : numbers The azimuth of the linear feature in degrees clockwise from north (i.e. ...
[ "Projects", "an", "azimuth", "of", "a", "linear", "feature", "onto", "a", "plane", "as", "a", "rake", "angle", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L580-L601
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
xyz2stereonet
def xyz2stereonet(x, y, z): """ Converts x, y, z in _world_ cartesian coordinates into lower-hemisphere stereonet coordinates. Parameters ---------- x, y, z : array-likes Sequences of world coordinates Returns ------- lon, lat : arrays Sequences of longitudes and la...
python
def xyz2stereonet(x, y, z): """ Converts x, y, z in _world_ cartesian coordinates into lower-hemisphere stereonet coordinates. Parameters ---------- x, y, z : array-likes Sequences of world coordinates Returns ------- lon, lat : arrays Sequences of longitudes and la...
[ "def", "xyz2stereonet", "(", "x", ",", "y", ",", "z", ")", ":", "x", ",", "y", ",", "z", "=", "np", ".", "atleast_1d", "(", "x", ",", "y", ",", "z", ")", "return", "cart2sph", "(", "-", "z", ",", "x", ",", "y", ")" ]
Converts x, y, z in _world_ cartesian coordinates into lower-hemisphere stereonet coordinates. Parameters ---------- x, y, z : array-likes Sequences of world coordinates Returns ------- lon, lat : arrays Sequences of longitudes and latitudes (in radians)
[ "Converts", "x", "y", "z", "in", "_world_", "cartesian", "coordinates", "into", "lower", "-", "hemisphere", "stereonet", "coordinates", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L603-L619
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
stereonet2xyz
def stereonet2xyz(lon, lat): """ Converts a sequence of longitudes and latitudes from a lower-hemisphere stereonet into _world_ x,y,z coordinates. Parameters ---------- lon, lat : array-likes Sequences of longitudes and latitudes (in radians) from a lower-hemisphere stereonet ...
python
def stereonet2xyz(lon, lat): """ Converts a sequence of longitudes and latitudes from a lower-hemisphere stereonet into _world_ x,y,z coordinates. Parameters ---------- lon, lat : array-likes Sequences of longitudes and latitudes (in radians) from a lower-hemisphere stereonet ...
[ "def", "stereonet2xyz", "(", "lon", ",", "lat", ")", ":", "lon", ",", "lat", "=", "np", ".", "atleast_1d", "(", "lon", ",", "lat", ")", "x", ",", "y", ",", "z", "=", "sph2cart", "(", "lon", ",", "lat", ")", "return", "y", ",", "z", ",", "-", ...
Converts a sequence of longitudes and latitudes from a lower-hemisphere stereonet into _world_ x,y,z coordinates. Parameters ---------- lon, lat : array-likes Sequences of longitudes and latitudes (in radians) from a lower-hemisphere stereonet Returns ------- x, y, z : arra...
[ "Converts", "a", "sequence", "of", "longitudes", "and", "latitudes", "from", "a", "lower", "-", "hemisphere", "stereonet", "into", "_world_", "x", "y", "z", "coordinates", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L621-L640
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
angular_distance
def angular_distance(first, second, bidirectional=True): """ Calculate the angular distance between two linear features or elementwise angular distance between two sets of linear features. (Note: a linear feature in this context is a point on a stereonet represented by a single latitude and longitud...
python
def angular_distance(first, second, bidirectional=True): """ Calculate the angular distance between two linear features or elementwise angular distance between two sets of linear features. (Note: a linear feature in this context is a point on a stereonet represented by a single latitude and longitud...
[ "def", "angular_distance", "(", "first", ",", "second", ",", "bidirectional", "=", "True", ")", ":", "lon1", ",", "lat1", "=", "first", "lon2", ",", "lat2", "=", "second", "lon1", ",", "lat1", ",", "lon2", ",", "lat2", "=", "np", ".", "atleast_1d", "...
Calculate the angular distance between two linear features or elementwise angular distance between two sets of linear features. (Note: a linear feature in this context is a point on a stereonet represented by a single latitude and longitude.) Parameters ---------- first : (lon, lat) 2xN array-l...
[ "Calculate", "the", "angular", "distance", "between", "two", "linear", "features", "or", "elementwise", "angular", "distance", "between", "two", "sets", "of", "linear", "features", ".", "(", "Note", ":", "a", "linear", "feature", "in", "this", "context", "is",...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L692-L763
train
joferkington/mplstereonet
mplstereonet/stereonet_math.py
_repole
def _repole(lon, lat, center): """ Reproject data such that ``center`` is the north pole. Returns lon, lat in the new, rotated reference frame. This is currently a sketch for a later function. Do not assume it works correctly. """ vec3 = sph2cart(*center) vec3 = np.squeeze(vec3) if ...
python
def _repole(lon, lat, center): """ Reproject data such that ``center`` is the north pole. Returns lon, lat in the new, rotated reference frame. This is currently a sketch for a later function. Do not assume it works correctly. """ vec3 = sph2cart(*center) vec3 = np.squeeze(vec3) if ...
[ "def", "_repole", "(", "lon", ",", "lat", ",", "center", ")", ":", "vec3", "=", "sph2cart", "(", "*", "center", ")", "vec3", "=", "np", ".", "squeeze", "(", "vec3", ")", "if", "not", "np", ".", "allclose", "(", "vec3", ",", "[", "0", ",", "0", ...
Reproject data such that ``center`` is the north pole. Returns lon, lat in the new, rotated reference frame. This is currently a sketch for a later function. Do not assume it works correctly.
[ "Reproject", "data", "such", "that", "center", "is", "the", "north", "pole", ".", "Returns", "lon", "lat", "in", "the", "new", "rotated", "reference", "frame", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_math.py#L765-L787
train
joferkington/mplstereonet
mplstereonet/analysis.py
_sd_of_eigenvector
def _sd_of_eigenvector(data, vec, measurement='poles', bidirectional=True): """Unifies ``fit_pole`` and ``fit_girdle``.""" lon, lat = _convert_measurements(data, measurement) vals, vecs = cov_eig(lon, lat, bidirectional) x, y, z = vecs[:, vec] s, d = stereonet_math.geographic2pole(*stereonet_math.ca...
python
def _sd_of_eigenvector(data, vec, measurement='poles', bidirectional=True): """Unifies ``fit_pole`` and ``fit_girdle``.""" lon, lat = _convert_measurements(data, measurement) vals, vecs = cov_eig(lon, lat, bidirectional) x, y, z = vecs[:, vec] s, d = stereonet_math.geographic2pole(*stereonet_math.ca...
[ "def", "_sd_of_eigenvector", "(", "data", ",", "vec", ",", "measurement", "=", "'poles'", ",", "bidirectional", "=", "True", ")", ":", "lon", ",", "lat", "=", "_convert_measurements", "(", "data", ",", "measurement", ")", "vals", ",", "vecs", "=", "cov_eig...
Unifies ``fit_pole`` and ``fit_girdle``.
[ "Unifies", "fit_pole", "and", "fit_girdle", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/analysis.py#L126-L132
train
joferkington/mplstereonet
mplstereonet/analysis.py
eigenvectors
def eigenvectors(*args, **kwargs): """ Finds the 3 eigenvectors and eigenvalues of the 3D covariance matrix of a series of geometries. This can be used to fit a plane/pole to a dataset or for shape fabric analysis (e.g. Flinn/Hsu plots). Input arguments will be interpreted as poles, lines, rakes, ...
python
def eigenvectors(*args, **kwargs): """ Finds the 3 eigenvectors and eigenvalues of the 3D covariance matrix of a series of geometries. This can be used to fit a plane/pole to a dataset or for shape fabric analysis (e.g. Flinn/Hsu plots). Input arguments will be interpreted as poles, lines, rakes, ...
[ "def", "eigenvectors", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lon", ",", "lat", "=", "_convert_measurements", "(", "args", ",", "kwargs", ".", "get", "(", "'measurement'", ",", "'poles'", ")", ")", "vals", ",", "vecs", "=", "cov_eig", ...
Finds the 3 eigenvectors and eigenvalues of the 3D covariance matrix of a series of geometries. This can be used to fit a plane/pole to a dataset or for shape fabric analysis (e.g. Flinn/Hsu plots). Input arguments will be interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on ...
[ "Finds", "the", "3", "eigenvectors", "and", "eigenvalues", "of", "the", "3D", "covariance", "matrix", "of", "a", "series", "of", "geometries", ".", "This", "can", "be", "used", "to", "fit", "a", "plane", "/", "pole", "to", "a", "dataset", "or", "for", ...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/analysis.py#L134-L195
train
joferkington/mplstereonet
mplstereonet/analysis.py
find_mean_vector
def find_mean_vector(*args, **kwargs): """ Returns the mean vector for a set of measurments. By default, this expects the input to be plunges and bearings, but the type of input can be controlled through the ``measurement`` kwarg. Parameters ---------- *args : 2 or 3 sequences of measureme...
python
def find_mean_vector(*args, **kwargs): """ Returns the mean vector for a set of measurments. By default, this expects the input to be plunges and bearings, but the type of input can be controlled through the ``measurement`` kwarg. Parameters ---------- *args : 2 or 3 sequences of measureme...
[ "def", "find_mean_vector", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lon", ",", "lat", "=", "_convert_measurements", "(", "args", ",", "kwargs", ".", "get", "(", "'measurement'", ",", "'lines'", ")", ")", "vector", ",", "r_value", "=", "ste...
Returns the mean vector for a set of measurments. By default, this expects the input to be plunges and bearings, but the type of input can be controlled through the ``measurement`` kwarg. Parameters ---------- *args : 2 or 3 sequences of measurements By default, this will be expected to be...
[ "Returns", "the", "mean", "vector", "for", "a", "set", "of", "measurments", ".", "By", "default", "this", "expects", "the", "input", "to", "be", "plunges", "and", "bearings", "but", "the", "type", "of", "input", "can", "be", "controlled", "through", "the",...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/analysis.py#L219-L264
train
joferkington/mplstereonet
mplstereonet/analysis.py
find_fisher_stats
def find_fisher_stats(*args, **kwargs): """ Returns the mean vector and summary statistics for a set of measurements. By default, this expects the input to be plunges and bearings, but the type of input can be controlled through the ``measurement`` kwarg. Parameters ---------- *args : 2 or ...
python
def find_fisher_stats(*args, **kwargs): """ Returns the mean vector and summary statistics for a set of measurements. By default, this expects the input to be plunges and bearings, but the type of input can be controlled through the ``measurement`` kwarg. Parameters ---------- *args : 2 or ...
[ "def", "find_fisher_stats", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# How the heck did this wind up as a separate function?", "lon", ",", "lat", "=", "_convert_measurements", "(", "args", ",", "kwargs", ".", "get", "(", "'measurement'", ",", "'lines'...
Returns the mean vector and summary statistics for a set of measurements. By default, this expects the input to be plunges and bearings, but the type of input can be controlled through the ``measurement`` kwarg. Parameters ---------- *args : 2 or 3 sequences of measurements By default, this...
[ "Returns", "the", "mean", "vector", "and", "summary", "statistics", "for", "a", "set", "of", "measurements", ".", "By", "default", "this", "expects", "the", "input", "to", "be", "plunges", "and", "bearings", "but", "the", "type", "of", "input", "can", "be"...
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/analysis.py#L266-L323
train
joferkington/mplstereonet
mplstereonet/analysis.py
kmeans
def kmeans(*args, **kwargs): """ Find centers of multi-modal clusters of data using a kmeans approach modified for spherical measurements. Parameters ---------- *args : 2 or 3 sequences of measurements By default, this will be expected to be ``strike`` & ``dip``, both array-lik...
python
def kmeans(*args, **kwargs): """ Find centers of multi-modal clusters of data using a kmeans approach modified for spherical measurements. Parameters ---------- *args : 2 or 3 sequences of measurements By default, this will be expected to be ``strike`` & ``dip``, both array-lik...
[ "def", "kmeans", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lon", ",", "lat", "=", "_convert_measurements", "(", "args", ",", "kwargs", ".", "get", "(", "'measurement'", ",", "'poles'", ")", ")", "num", "=", "kwargs", ".", "get", "(", "'...
Find centers of multi-modal clusters of data using a kmeans approach modified for spherical measurements. Parameters ---------- *args : 2 or 3 sequences of measurements By default, this will be expected to be ``strike`` & ``dip``, both array-like sequences representing poles to planes....
[ "Find", "centers", "of", "multi", "-", "modal", "clusters", "of", "data", "using", "a", "kmeans", "approach", "modified", "for", "spherical", "measurements", "." ]
f6d78ca49807915d4223e864e12bb24d497cc2d6
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/analysis.py#L325-L400
train
heroku-python/django-postgrespool
django_postgrespool/base.py
is_disconnect
def is_disconnect(e, connection, cursor): """ Connection state check from SQLAlchemy: https://bitbucket.org/sqlalchemy/sqlalchemy/src/tip/lib/sqlalchemy/dialects/postgresql/psycopg2.py """ if isinstance(e, OperationalError): # these error messages from libpq: interfaces/libpq/fe-misc.c. ...
python
def is_disconnect(e, connection, cursor): """ Connection state check from SQLAlchemy: https://bitbucket.org/sqlalchemy/sqlalchemy/src/tip/lib/sqlalchemy/dialects/postgresql/psycopg2.py """ if isinstance(e, OperationalError): # these error messages from libpq: interfaces/libpq/fe-misc.c. ...
[ "def", "is_disconnect", "(", "e", ",", "connection", ",", "cursor", ")", ":", "if", "isinstance", "(", "e", ",", "OperationalError", ")", ":", "# these error messages from libpq: interfaces/libpq/fe-misc.c.", "# TODO: these are sent through gettext in libpq and we can't", "# ...
Connection state check from SQLAlchemy: https://bitbucket.org/sqlalchemy/sqlalchemy/src/tip/lib/sqlalchemy/dialects/postgresql/psycopg2.py
[ "Connection", "state", "check", "from", "SQLAlchemy", ":", "https", ":", "//", "bitbucket", ".", "org", "/", "sqlalchemy", "/", "sqlalchemy", "/", "src", "/", "tip", "/", "lib", "/", "sqlalchemy", "/", "dialects", "/", "postgresql", "/", "psycopg2", ".", ...
ce83a4d49c19eded86d86d5fcfa8daaeea5ef662
https://github.com/heroku-python/django-postgrespool/blob/ce83a4d49c19eded86d86d5fcfa8daaeea5ef662/django_postgrespool/base.py#L42-L64
train
heroku-python/django-postgrespool
django_postgrespool/base.py
DatabaseWrapper._dispose
def _dispose(self): """Dispose of the pool for this instance, closing all connections.""" self.close() # _DBProxy.dispose doesn't actually call dispose on the pool conn_params = self.get_connection_params() key = db_pool._serialize(**conn_params) try: pool = d...
python
def _dispose(self): """Dispose of the pool for this instance, closing all connections.""" self.close() # _DBProxy.dispose doesn't actually call dispose on the pool conn_params = self.get_connection_params() key = db_pool._serialize(**conn_params) try: pool = d...
[ "def", "_dispose", "(", "self", ")", ":", "self", ".", "close", "(", ")", "# _DBProxy.dispose doesn't actually call dispose on the pool", "conn_params", "=", "self", ".", "get_connection_params", "(", ")", "key", "=", "db_pool", ".", "_serialize", "(", "*", "*", ...
Dispose of the pool for this instance, closing all connections.
[ "Dispose", "of", "the", "pool", "for", "this", "instance", "closing", "all", "connections", "." ]
ce83a4d49c19eded86d86d5fcfa8daaeea5ef662
https://github.com/heroku-python/django-postgrespool/blob/ce83a4d49c19eded86d86d5fcfa8daaeea5ef662/django_postgrespool/base.py#L91-L103
train
stitchfix/fauxtograph
fauxtograph/vaegan.py
calc_fc_size
def calc_fc_size(img_height, img_width): '''Calculates shape of data after encoding. Parameters ---------- img_height : int Height of input image. img_width : int Width of input image. Returns ------- encoded_shape : tuple(int) Gives back 3-tuple with new dims. ...
python
def calc_fc_size(img_height, img_width): '''Calculates shape of data after encoding. Parameters ---------- img_height : int Height of input image. img_width : int Width of input image. Returns ------- encoded_shape : tuple(int) Gives back 3-tuple with new dims. ...
[ "def", "calc_fc_size", "(", "img_height", ",", "img_width", ")", ":", "height", ",", "width", "=", "img_height", ",", "img_width", "for", "_", "in", "range", "(", "5", ")", ":", "height", ",", "width", "=", "_get_conv_outsize", "(", "(", "height", ",", ...
Calculates shape of data after encoding. Parameters ---------- img_height : int Height of input image. img_width : int Width of input image. Returns ------- encoded_shape : tuple(int) Gives back 3-tuple with new dims.
[ "Calculates", "shape", "of", "data", "after", "encoding", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/vaegan.py#L540-L562
train
stitchfix/fauxtograph
fauxtograph/vaegan.py
calc_im_size
def calc_im_size(img_height, img_width): '''Calculates shape of data after decoding. Parameters ---------- img_height : int Height of encoded data. img_width : int Width of encoded data. Returns ------- encoded_shape : tuple(int) Gives back 2-tuple with decoded ...
python
def calc_im_size(img_height, img_width): '''Calculates shape of data after decoding. Parameters ---------- img_height : int Height of encoded data. img_width : int Width of encoded data. Returns ------- encoded_shape : tuple(int) Gives back 2-tuple with decoded ...
[ "def", "calc_im_size", "(", "img_height", ",", "img_width", ")", ":", "height", ",", "width", "=", "img_height", ",", "img_width", "for", "_", "in", "range", "(", "5", ")", ":", "height", ",", "width", "=", "_get_deconv_outsize", "(", "(", "height", ",",...
Calculates shape of data after decoding. Parameters ---------- img_height : int Height of encoded data. img_width : int Width of encoded data. Returns ------- encoded_shape : tuple(int) Gives back 2-tuple with decoded image dimensions.
[ "Calculates", "shape", "of", "data", "after", "decoding", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/vaegan.py#L565-L585
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
get_paths
def get_paths(directory): '''Gets all the paths of non-hidden files in a directory and returns a list of those paths. Parameters ---------- directory : str The directory whose contents you wish to grab. Returns ------- paths : List[str] ''' fnames = [os.path.join(dir...
python
def get_paths(directory): '''Gets all the paths of non-hidden files in a directory and returns a list of those paths. Parameters ---------- directory : str The directory whose contents you wish to grab. Returns ------- paths : List[str] ''' fnames = [os.path.join(dir...
[ "def", "get_paths", "(", "directory", ")", ":", "fnames", "=", "[", "os", ".", "path", ".", "join", "(", "directory", ",", "f", ")", "for", "f", "in", "os", ".", "listdir", "(", "directory", ")", "if", "os", ".", "path", ".", "isfile", "(", "os",...
Gets all the paths of non-hidden files in a directory and returns a list of those paths. Parameters ---------- directory : str The directory whose contents you wish to grab. Returns ------- paths : List[str]
[ "Gets", "all", "the", "paths", "of", "non", "-", "hidden", "files", "in", "a", "directory", "and", "returns", "a", "list", "of", "those", "paths", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L1570-L1587
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
image_resize
def image_resize(file_paths, new_dir, width, height): '''Resizes all images with given paths to new dimensions. Uses up/downscaling with antialiasing. Parameters ---------- file_paths : List[str] List of path strings for image to resize. new_dir : str Directory to place resi...
python
def image_resize(file_paths, new_dir, width, height): '''Resizes all images with given paths to new dimensions. Uses up/downscaling with antialiasing. Parameters ---------- file_paths : List[str] List of path strings for image to resize. new_dir : str Directory to place resi...
[ "def", "image_resize", "(", "file_paths", ",", "new_dir", ",", "width", ",", "height", ")", ":", "if", "new_dir", "[", "-", "1", "]", "!=", "'/'", ":", "new_dir", "+=", "'/'", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ...
Resizes all images with given paths to new dimensions. Uses up/downscaling with antialiasing. Parameters ---------- file_paths : List[str] List of path strings for image to resize. new_dir : str Directory to place resized images. width : int Target width of new resiz...
[ "Resizes", "all", "images", "with", "given", "paths", "to", "new", "dimensions", ".", "Uses", "up", "/", "downscaling", "with", "antialiasing", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L1590-L1614
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
VAE.inverse_transform
def inverse_transform(self, data, test=False): '''Transform latent vectors into images. Parameters ---------- data : array-like shape (n_images, latent_width) Input numpy array of images. test [optional] : bool Controls the test boolean for batch normaliz...
python
def inverse_transform(self, data, test=False): '''Transform latent vectors into images. Parameters ---------- data : array-like shape (n_images, latent_width) Input numpy array of images. test [optional] : bool Controls the test boolean for batch normaliz...
[ "def", "inverse_transform", "(", "self", ",", "data", ",", "test", "=", "False", ")", ":", "if", "not", "type", "(", "data", ")", "==", "Variable", ":", "if", "len", "(", "data", ".", "shape", ")", "<", "2", ":", "data", "=", "data", "[", "np", ...
Transform latent vectors into images. Parameters ---------- data : array-like shape (n_images, latent_width) Input numpy array of images. test [optional] : bool Controls the test boolean for batch normalization. Returns ------- images : a...
[ "Transform", "latent", "vectors", "into", "images", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L175-L218
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
VAE.load_images
def load_images(self, filepaths): '''Load in image files from list of paths. Parameters ---------- filepaths : List[str] List of file paths of images to be loaded. Returns ------- images : array-like shape (n_images, n_colors, image_width, image_hei...
python
def load_images(self, filepaths): '''Load in image files from list of paths. Parameters ---------- filepaths : List[str] List of file paths of images to be loaded. Returns ------- images : array-like shape (n_images, n_colors, image_width, image_hei...
[ "def", "load_images", "(", "self", ",", "filepaths", ")", ":", "def", "read", "(", "fname", ")", ":", "im", "=", "Image", ".", "open", "(", "fname", ")", "im", "=", "np", ".", "float32", "(", "im", ")", "return", "im", "/", "255.", "x_all", "=", ...
Load in image files from list of paths. Parameters ---------- filepaths : List[str] List of file paths of images to be loaded. Returns ------- images : array-like shape (n_images, n_colors, image_width, image_height) Images normalized to have pi...
[ "Load", "in", "image", "files", "from", "list", "of", "paths", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L220-L244
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
VAE.fit
def fit( self, img_data, save_freq=-1, pic_freq=-1, n_epochs=100, batch_size=50, weight_decay=True, model_path='./VAE_training_model/', img_path='./VAE_training_images/', img_out_width=10 ): '''Fit the VAE model to the image d...
python
def fit( self, img_data, save_freq=-1, pic_freq=-1, n_epochs=100, batch_size=50, weight_decay=True, model_path='./VAE_training_model/', img_path='./VAE_training_images/', img_out_width=10 ): '''Fit the VAE model to the image d...
[ "def", "fit", "(", "self", ",", "img_data", ",", "save_freq", "=", "-", "1", ",", "pic_freq", "=", "-", "1", ",", "n_epochs", "=", "100", ",", "batch_size", "=", "50", ",", "weight_decay", "=", "True", ",", "model_path", "=", "'./VAE_training_model/'", ...
Fit the VAE model to the image data. Parameters ---------- img_data : array-like shape (n_images, n_colors, image_width, image_height) Images used to fit VAE model. save_freq [optional] : int Sets the number of epochs to wait before saving the model and optimize...
[ "Fit", "the", "VAE", "model", "to", "the", "image", "data", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L246-L359
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
VAE.save
def save(self, path, name, save_meta=True): '''Saves model as a sequence of files in the format: {path}/{name}_{'model', 'opt', 'meta'}.h5 Parameters ---------- path : str The directory of the file you wish to save the model to. name : str The...
python
def save(self, path, name, save_meta=True): '''Saves model as a sequence of files in the format: {path}/{name}_{'model', 'opt', 'meta'}.h5 Parameters ---------- path : str The directory of the file you wish to save the model to. name : str The...
[ "def", "save", "(", "self", ",", "path", ",", "name", ",", "save_meta", "=", "True", ")", ":", "_save_model", "(", "self", ".", "model", ",", "str", "(", "path", ")", ",", "\"%s_model\"", "%", "str", "(", "name", ")", ")", "_save_model", "(", "self...
Saves model as a sequence of files in the format: {path}/{name}_{'model', 'opt', 'meta'}.h5 Parameters ---------- path : str The directory of the file you wish to save the model to. name : str The name prefix of the model and optimizer files you wish ...
[ "Saves", "model", "as", "a", "sequence", "of", "files", "in", "the", "format", ":", "{", "path", "}", "/", "{", "name", "}", "_", "{", "model", "opt", "meta", "}", ".", "h5" ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L396-L414
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
VAE.load
def load(cls, model, opt, meta, flag_gpu=None): '''Loads in model as a class instance with with the specified model and optimizer states. Parameters ---------- model : str Path to the model state file. opt : str Path to the optimizer state file...
python
def load(cls, model, opt, meta, flag_gpu=None): '''Loads in model as a class instance with with the specified model and optimizer states. Parameters ---------- model : str Path to the model state file. opt : str Path to the optimizer state file...
[ "def", "load", "(", "cls", ",", "model", ",", "opt", ",", "meta", ",", "flag_gpu", "=", "None", ")", ":", "mess", "=", "\"Model file {0} does not exist. Please check the file path.\"", "assert", "os", ".", "path", ".", "exists", "(", "model", ")", ",", "mess...
Loads in model as a class instance with with the specified model and optimizer states. Parameters ---------- model : str Path to the model state file. opt : str Path to the optimizer state file. meta : str Path to the class metadata...
[ "Loads", "in", "model", "as", "a", "class", "instance", "with", "with", "the", "specified", "model", "and", "optimizer", "states", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L417-L455
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
GAN.fit
def fit( self, img_data, save_freq=-1, pic_freq=-1, n_epochs=100, batch_size=50, weight_decay=True, model_path='./GAN_training_model/', img_path='./GAN_training_images/', img_out_width=10, mirroring=False ): '''Fit the G...
python
def fit( self, img_data, save_freq=-1, pic_freq=-1, n_epochs=100, batch_size=50, weight_decay=True, model_path='./GAN_training_model/', img_path='./GAN_training_images/', img_out_width=10, mirroring=False ): '''Fit the G...
[ "def", "fit", "(", "self", ",", "img_data", ",", "save_freq", "=", "-", "1", ",", "pic_freq", "=", "-", "1", ",", "n_epochs", "=", "100", ",", "batch_size", "=", "50", ",", "weight_decay", "=", "True", ",", "model_path", "=", "'./GAN_training_model/'", ...
Fit the GAN model to the image data. Parameters ---------- img_data : array-like shape (n_images, n_colors, image_width, image_height) Images used to fit VAE model. save_freq [optional] : int Sets the number of epochs to wait before saving the model and optimize...
[ "Fit", "the", "GAN", "model", "to", "the", "image", "data", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L667-L804
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
GAN.save
def save(self, path, name, save_meta=True): '''Saves model as a sequence of files in the format: {path}/{name}_{'dec', 'disc', 'dec_opt', 'disc_opt', 'meta'}.h5 Parameters ---------- path : str The directory of the file you wish to save the model to. ...
python
def save(self, path, name, save_meta=True): '''Saves model as a sequence of files in the format: {path}/{name}_{'dec', 'disc', 'dec_opt', 'disc_opt', 'meta'}.h5 Parameters ---------- path : str The directory of the file you wish to save the model to. ...
[ "def", "save", "(", "self", ",", "path", ",", "name", ",", "save_meta", "=", "True", ")", ":", "_save_model", "(", "self", ".", "dec", ",", "str", "(", "path", ")", ",", "\"%s_dec\"", "%", "str", "(", "name", ")", ")", "_save_model", "(", "self", ...
Saves model as a sequence of files in the format: {path}/{name}_{'dec', 'disc', 'dec_opt', 'disc_opt', 'meta'}.h5 Parameters ---------- path : str The directory of the file you wish to save the model to. name : str The name prefix of the m...
[ "Saves", "model", "as", "a", "sequence", "of", "files", "in", "the", "format", ":", "{", "path", "}", "/", "{", "name", "}", "_", "{", "dec", "disc", "dec_opt", "disc_opt", "meta", "}", ".", "h5" ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L846-L867
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
VAEGAN.transform
def transform(self, data, test=False): '''Transform image data to latent space. Parameters ---------- data : array-like shape (n_images, image_width, image_height, n_colors) Input numpy array of images. test [optional] : bool ...
python
def transform(self, data, test=False): '''Transform image data to latent space. Parameters ---------- data : array-like shape (n_images, image_width, image_height, n_colors) Input numpy array of images. test [optional] : bool ...
[ "def", "transform", "(", "self", ",", "data", ",", "test", "=", "False", ")", ":", "#make sure that data has the right shape.", "if", "not", "type", "(", "data", ")", "==", "Variable", ":", "if", "len", "(", "data", ".", "shape", ")", "<", "4", ":", "d...
Transform image data to latent space. Parameters ---------- data : array-like shape (n_images, image_width, image_height, n_colors) Input numpy array of images. test [optional] : bool Controls the test boolean for batch normaliz...
[ "Transform", "image", "data", "to", "latent", "space", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L1122-L1171
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
VAEGAN.fit
def fit( self, img_data, gamma=1.0, save_freq=-1, pic_freq=-1, n_epochs=100, batch_size=50, weight_decay=True, model_path='./VAEGAN_training_model/', img_path='./VAEGAN_training_images/', img_out_width=10, mirroring=False ...
python
def fit( self, img_data, gamma=1.0, save_freq=-1, pic_freq=-1, n_epochs=100, batch_size=50, weight_decay=True, model_path='./VAEGAN_training_model/', img_path='./VAEGAN_training_images/', img_out_width=10, mirroring=False ...
[ "def", "fit", "(", "self", ",", "img_data", ",", "gamma", "=", "1.0", ",", "save_freq", "=", "-", "1", ",", "pic_freq", "=", "-", "1", ",", "n_epochs", "=", "100", ",", "batch_size", "=", "50", ",", "weight_decay", "=", "True", ",", "model_path", "...
Fit the VAE/GAN model to the image data. Parameters ---------- img_data : array-like shape (n_images, n_colors, image_width, image_height) Images used to fit VAE model. gamma [optional] : float Sets the multiplicative factor that weights the relative importance ...
[ "Fit", "the", "VAE", "/", "GAN", "model", "to", "the", "image", "data", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L1243-L1418
train
stitchfix/fauxtograph
fauxtograph/fauxtograph.py
VAEGAN.load
def load(cls, enc, dec, disc, enc_opt, dec_opt, disc_opt, meta, flag_gpu=None): '''Loads in model as a class instance with with the specified model and optimizer states. Parameters ---------- enc : str Path to the encoder state file. dec : str ...
python
def load(cls, enc, dec, disc, enc_opt, dec_opt, disc_opt, meta, flag_gpu=None): '''Loads in model as a class instance with with the specified model and optimizer states. Parameters ---------- enc : str Path to the encoder state file. dec : str ...
[ "def", "load", "(", "cls", ",", "enc", ",", "dec", ",", "disc", ",", "enc_opt", ",", "dec_opt", ",", "disc_opt", ",", "meta", ",", "flag_gpu", "=", "None", ")", ":", "mess", "=", "\"Model file {0} does not exist. Please check the file path.\"", "assert", "os",...
Loads in model as a class instance with with the specified model and optimizer states. Parameters ---------- enc : str Path to the encoder state file. dec : str Path to the decoder/generator state file. disc : str Path to the discri...
[ "Loads", "in", "model", "as", "a", "class", "instance", "with", "with", "the", "specified", "model", "and", "optimizer", "states", "." ]
393f402151126991dac1f2ee4cdd4c6aba817a5d
https://github.com/stitchfix/fauxtograph/blob/393f402151126991dac1f2ee4cdd4c6aba817a5d/fauxtograph/fauxtograph.py#L1498-L1555
train
dhermes/bezier
src/bezier/_surface_helpers.py
polynomial_sign
def polynomial_sign(poly_surface, degree): r"""Determine the "sign" of a polynomial on the reference triangle. .. note:: This is used **only** by :meth:`Surface._compute_valid` (which is in turn used to compute / cache the :attr:`Surface.is_valid` property). Checks if a polynomial :m...
python
def polynomial_sign(poly_surface, degree): r"""Determine the "sign" of a polynomial on the reference triangle. .. note:: This is used **only** by :meth:`Surface._compute_valid` (which is in turn used to compute / cache the :attr:`Surface.is_valid` property). Checks if a polynomial :m...
[ "def", "polynomial_sign", "(", "poly_surface", ",", "degree", ")", ":", "# The indices where the corner nodes in a surface are.", "corner_indices", "=", "(", "0", ",", "degree", ",", "-", "1", ")", "sub_polys", "=", "[", "poly_surface", "]", "signs", "=", "set", ...
r"""Determine the "sign" of a polynomial on the reference triangle. .. note:: This is used **only** by :meth:`Surface._compute_valid` (which is in turn used to compute / cache the :attr:`Surface.is_valid` property). Checks if a polynomial :math:`p(s, t)` is positive, negative or mixe...
[ "r", "Determine", "the", "sign", "of", "a", "polynomial", "on", "the", "reference", "triangle", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L719-L791
train
dhermes/bezier
src/bezier/_surface_helpers.py
quadratic_jacobian_polynomial
def quadratic_jacobian_polynomial(nodes): r"""Compute the Jacobian determinant of a quadratic surface. .. note:: This is used **only** by :meth:`Surface._compute_valid` (which is in turn used to compute / cache the :attr:`Surface.is_valid` property). Converts :math:`\det(J(s, t))` to...
python
def quadratic_jacobian_polynomial(nodes): r"""Compute the Jacobian determinant of a quadratic surface. .. note:: This is used **only** by :meth:`Surface._compute_valid` (which is in turn used to compute / cache the :attr:`Surface.is_valid` property). Converts :math:`\det(J(s, t))` to...
[ "def", "quadratic_jacobian_polynomial", "(", "nodes", ")", ":", "# First evaluate the Jacobian at each of the 6 nodes.", "jac_parts", "=", "_helpers", ".", "matrix_product", "(", "nodes", ",", "_QUADRATIC_JACOBIAN_HELPER", ")", "jac_at_nodes", "=", "np", ".", "empty", "("...
r"""Compute the Jacobian determinant of a quadratic surface. .. note:: This is used **only** by :meth:`Surface._compute_valid` (which is in turn used to compute / cache the :attr:`Surface.is_valid` property). Converts :math:`\det(J(s, t))` to a polynomial on the reference triangle an...
[ "r", "Compute", "the", "Jacobian", "determinant", "of", "a", "quadratic", "surface", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L815-L851
train
dhermes/bezier
src/bezier/_surface_helpers.py
cubic_jacobian_polynomial
def cubic_jacobian_polynomial(nodes): r"""Compute the Jacobian determinant of a cubic surface. .. note:: This is used **only** by :meth:`Surface._compute_valid` (which is in turn used to compute / cache the :attr:`Surface.is_valid` property). Converts :math:`\det(J(s, t))` to a polyn...
python
def cubic_jacobian_polynomial(nodes): r"""Compute the Jacobian determinant of a cubic surface. .. note:: This is used **only** by :meth:`Surface._compute_valid` (which is in turn used to compute / cache the :attr:`Surface.is_valid` property). Converts :math:`\det(J(s, t))` to a polyn...
[ "def", "cubic_jacobian_polynomial", "(", "nodes", ")", ":", "# First evaluate the Jacobian at each of the 15 nodes", "# in the quartic triangle.", "jac_parts", "=", "_helpers", ".", "matrix_product", "(", "nodes", ",", "_CUBIC_JACOBIAN_HELPER", ")", "jac_at_nodes", "=", "np",...
r"""Compute the Jacobian determinant of a cubic surface. .. note:: This is used **only** by :meth:`Surface._compute_valid` (which is in turn used to compute / cache the :attr:`Surface.is_valid` property). Converts :math:`\det(J(s, t))` to a polynomial on the reference triangle and re...
[ "r", "Compute", "the", "Jacobian", "determinant", "of", "a", "cubic", "surface", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L854-L901
train
dhermes/bezier
src/bezier/_surface_helpers.py
_de_casteljau_one_round
def _de_casteljau_one_round(nodes, degree, lambda1, lambda2, lambda3): r"""Performs one "round" of the de Casteljau algorithm for surfaces. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. .. note:: This is a helper function, ...
python
def _de_casteljau_one_round(nodes, degree, lambda1, lambda2, lambda3): r"""Performs one "round" of the de Casteljau algorithm for surfaces. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. .. note:: This is a helper function, ...
[ "def", "_de_casteljau_one_round", "(", "nodes", ",", "degree", ",", "lambda1", ",", "lambda2", ",", "lambda3", ")", ":", "dimension", ",", "num_nodes", "=", "nodes", ".", "shape", "num_new_nodes", "=", "num_nodes", "-", "degree", "-", "1", "new_nodes", "=", ...
r"""Performs one "round" of the de Casteljau algorithm for surfaces. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. .. note:: This is a helper function, used by :func:`make_transform` and :func:`_specialize_surface` (and ...
[ "r", "Performs", "one", "round", "of", "the", "de", "Casteljau", "algorithm", "for", "surfaces", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L904-L967
train
dhermes/bezier
src/bezier/_surface_helpers.py
make_transform
def make_transform(degree, weights_a, weights_b, weights_c): """Compute matrices corresponding to the de Casteljau algorithm. .. note:: This is a helper used only by :func:`_specialize_surface`. Applies the de Casteljau to the identity matrix, thus effectively caching the algorithm in a transf...
python
def make_transform(degree, weights_a, weights_b, weights_c): """Compute matrices corresponding to the de Casteljau algorithm. .. note:: This is a helper used only by :func:`_specialize_surface`. Applies the de Casteljau to the identity matrix, thus effectively caching the algorithm in a transf...
[ "def", "make_transform", "(", "degree", ",", "weights_a", ",", "weights_b", ",", "weights_c", ")", ":", "num_nodes", "=", "(", "(", "degree", "+", "1", ")", "*", "(", "degree", "+", "2", ")", ")", "//", "2", "id_mat", "=", "np", ".", "eye", "(", ...
Compute matrices corresponding to the de Casteljau algorithm. .. note:: This is a helper used only by :func:`_specialize_surface`. Applies the de Casteljau to the identity matrix, thus effectively caching the algorithm in a transformation matrix. .. note:: This is premature optimizati...
[ "Compute", "matrices", "corresponding", "to", "the", "de", "Casteljau", "algorithm", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L970-L1010
train
dhermes/bezier
src/bezier/_surface_helpers.py
reduced_to_matrix
def reduced_to_matrix(shape, degree, vals_by_weight): r"""Converts a reduced values dictionary into a matrix. .. note:: This is a helper used only by :func:`_specialize_surface`. The ``vals_by_weight`` mapping has keys of the form: ``(0, ..., 1, ..., 2, ...)`` where the ``0`` corresponds t...
python
def reduced_to_matrix(shape, degree, vals_by_weight): r"""Converts a reduced values dictionary into a matrix. .. note:: This is a helper used only by :func:`_specialize_surface`. The ``vals_by_weight`` mapping has keys of the form: ``(0, ..., 1, ..., 2, ...)`` where the ``0`` corresponds t...
[ "def", "reduced_to_matrix", "(", "shape", ",", "degree", ",", "vals_by_weight", ")", ":", "result", "=", "np", ".", "empty", "(", "shape", ",", "order", "=", "\"F\"", ")", "index", "=", "0", "for", "k", "in", "six", ".", "moves", ".", "xrange", "(", ...
r"""Converts a reduced values dictionary into a matrix. .. note:: This is a helper used only by :func:`_specialize_surface`. The ``vals_by_weight`` mapping has keys of the form: ``(0, ..., 1, ..., 2, ...)`` where the ``0`` corresponds to the number of times the first set of barycentric wei...
[ "r", "Converts", "a", "reduced", "values", "dictionary", "into", "a", "matrix", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1013-L1054
train
dhermes/bezier
src/bezier/_surface_helpers.py
_specialize_surface
def _specialize_surface(nodes, degree, weights_a, weights_b, weights_c): """Specialize a surface to a reparameterization .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Does so by taking three points (in barycentric form) within the ...
python
def _specialize_surface(nodes, degree, weights_a, weights_b, weights_c): """Specialize a surface to a reparameterization .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Does so by taking three points (in barycentric form) within the ...
[ "def", "_specialize_surface", "(", "nodes", ",", "degree", ",", "weights_a", ",", "weights_b", ",", "weights_c", ")", ":", "# Uses A-->0, B-->1, C-->2 to represent the specialization used.", "partial_vals", "=", "{", "(", "0", ",", ")", ":", "de_casteljau_one_round", ...
Specialize a surface to a reparameterization .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Does so by taking three points (in barycentric form) within the reference triangle and then reparameterizing the surface onto the triang...
[ "Specialize", "a", "surface", "to", "a", "reparameterization" ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1057-L1111
train
dhermes/bezier
src/bezier/_surface_helpers.py
_subdivide_nodes
def _subdivide_nodes(nodes, degree): """Subdivide a surface into four sub-surfaces. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Does so by taking the unit triangle (i.e. the domain of the surface) and splitting it into four s...
python
def _subdivide_nodes(nodes, degree): """Subdivide a surface into four sub-surfaces. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Does so by taking the unit triangle (i.e. the domain of the surface) and splitting it into four s...
[ "def", "_subdivide_nodes", "(", "nodes", ",", "degree", ")", ":", "if", "degree", "==", "1", ":", "nodes_a", "=", "_helpers", ".", "matrix_product", "(", "nodes", ",", "LINEAR_SUBDIVIDE_A", ")", "nodes_b", "=", "_helpers", ".", "matrix_product", "(", "nodes"...
Subdivide a surface into four sub-surfaces. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Does so by taking the unit triangle (i.e. the domain of the surface) and splitting it into four sub-triangles by connecting the midpoints of ...
[ "Subdivide", "a", "surface", "into", "four", "sub", "-", "surfaces", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1114-L1183
train
dhermes/bezier
src/bezier/_surface_helpers.py
jacobian_s
def jacobian_s(nodes, degree, dimension): r"""Compute :math:`\frac{\partial B}{\partial s}`. .. note:: This is a helper for :func:`_jacobian_both`, which has an equivalent Fortran implementation. Args: nodes (numpy.ndarray): Array of nodes in a surface. degree (int): The deg...
python
def jacobian_s(nodes, degree, dimension): r"""Compute :math:`\frac{\partial B}{\partial s}`. .. note:: This is a helper for :func:`_jacobian_both`, which has an equivalent Fortran implementation. Args: nodes (numpy.ndarray): Array of nodes in a surface. degree (int): The deg...
[ "def", "jacobian_s", "(", "nodes", ",", "degree", ",", "dimension", ")", ":", "num_nodes", "=", "(", "degree", "*", "(", "degree", "+", "1", ")", ")", "//", "2", "result", "=", "np", ".", "empty", "(", "(", "dimension", ",", "num_nodes", ")", ",", ...
r"""Compute :math:`\frac{\partial B}{\partial s}`. .. note:: This is a helper for :func:`_jacobian_both`, which has an equivalent Fortran implementation. Args: nodes (numpy.ndarray): Array of nodes in a surface. degree (int): The degree of the surface. dimension (int): T...
[ "r", "Compute", ":", "math", ":", "\\", "frac", "{", "\\", "partial", "B", "}", "{", "\\", "partial", "s", "}", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1186-L1215
train
dhermes/bezier
src/bezier/_surface_helpers.py
_jacobian_both
def _jacobian_both(nodes, degree, dimension): r"""Compute :math:`s` and :math:`t` partial of :math:`B`. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Array of nodes in a surface. degree ...
python
def _jacobian_both(nodes, degree, dimension): r"""Compute :math:`s` and :math:`t` partial of :math:`B`. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Array of nodes in a surface. degree ...
[ "def", "_jacobian_both", "(", "nodes", ",", "degree", ",", "dimension", ")", ":", "_", ",", "num_nodes", "=", "nodes", ".", "shape", "result", "=", "np", ".", "empty", "(", "(", "2", "*", "dimension", ",", "num_nodes", "-", "degree", "-", "1", ")", ...
r"""Compute :math:`s` and :math:`t` partial of :math:`B`. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Array of nodes in a surface. degree (int): The degree of the surface. dimensio...
[ "r", "Compute", ":", "math", ":", "s", "and", ":", "math", ":", "t", "partial", "of", ":", "math", ":", "B", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1252-L1273
train
dhermes/bezier
src/bezier/_surface_helpers.py
_jacobian_det
def _jacobian_det(nodes, degree, st_vals): r"""Compute :math:`\det(D B)` at a set of values. This requires that :math:`B \in \mathbf{R}^2`. .. note:: This assumes but does not check that each ``(s, t)`` in ``st_vals`` is inside the reference triangle. .. warning:: This relies o...
python
def _jacobian_det(nodes, degree, st_vals): r"""Compute :math:`\det(D B)` at a set of values. This requires that :math:`B \in \mathbf{R}^2`. .. note:: This assumes but does not check that each ``(s, t)`` in ``st_vals`` is inside the reference triangle. .. warning:: This relies o...
[ "def", "_jacobian_det", "(", "nodes", ",", "degree", ",", "st_vals", ")", ":", "jac_nodes", "=", "jacobian_both", "(", "nodes", ",", "degree", ",", "2", ")", "if", "degree", "==", "1", ":", "num_vals", ",", "_", "=", "st_vals", ".", "shape", "bs_bt_val...
r"""Compute :math:`\det(D B)` at a set of values. This requires that :math:`B \in \mathbf{R}^2`. .. note:: This assumes but does not check that each ``(s, t)`` in ``st_vals`` is inside the reference triangle. .. warning:: This relies on helpers in :mod:`bezier` for computing the ...
[ "r", "Compute", ":", "math", ":", "\\", "det", "(", "D", "B", ")", "at", "a", "set", "of", "values", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1276-L1356
train
dhermes/bezier
src/bezier/_surface_helpers.py
classify_tangent_intersection
def classify_tangent_intersection( intersection, nodes1, tangent1, nodes2, tangent2 ): """Helper for func:`classify_intersection` at tangencies. .. note:: This is a helper used only by :func:`classify_intersection`. Args: intersection (.Intersection): An intersection object. no...
python
def classify_tangent_intersection( intersection, nodes1, tangent1, nodes2, tangent2 ): """Helper for func:`classify_intersection` at tangencies. .. note:: This is a helper used only by :func:`classify_intersection`. Args: intersection (.Intersection): An intersection object. no...
[ "def", "classify_tangent_intersection", "(", "intersection", ",", "nodes1", ",", "tangent1", ",", "nodes2", ",", "tangent2", ")", ":", "# Each array is 2 x 1 (i.e. a column vector), we want the vector", "# dot product.", "dot_prod", "=", "np", ".", "vdot", "(", "tangent1"...
Helper for func:`classify_intersection` at tangencies. .. note:: This is a helper used only by :func:`classify_intersection`. Args: intersection (.Intersection): An intersection object. nodes1 (numpy.ndarray): Control points for the first curve at the intersection. ...
[ "Helper", "for", "func", ":", "classify_intersection", "at", "tangencies", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1359-L1429
train
dhermes/bezier
src/bezier/_surface_helpers.py
ignored_edge_corner
def ignored_edge_corner(edge_tangent, corner_tangent, corner_previous_edge): """Check ignored when a corner lies **inside** another edge. .. note:: This is a helper used only by :func:`ignored_corner`, which in turn is only used by :func:`classify_intersection`. Helper for :func:`ignored_co...
python
def ignored_edge_corner(edge_tangent, corner_tangent, corner_previous_edge): """Check ignored when a corner lies **inside** another edge. .. note:: This is a helper used only by :func:`ignored_corner`, which in turn is only used by :func:`classify_intersection`. Helper for :func:`ignored_co...
[ "def", "ignored_edge_corner", "(", "edge_tangent", ",", "corner_tangent", ",", "corner_previous_edge", ")", ":", "cross_prod", "=", "_helpers", ".", "cross_product", "(", "edge_tangent", ".", "ravel", "(", "order", "=", "\"F\"", ")", ",", "corner_tangent", ".", ...
Check ignored when a corner lies **inside** another edge. .. note:: This is a helper used only by :func:`ignored_corner`, which in turn is only used by :func:`classify_intersection`. Helper for :func:`ignored_corner` where one of ``s`` and ``t`` are ``0``, but **not both**. Args: ...
[ "Check", "ignored", "when", "a", "corner", "lies", "**", "inside", "**", "another", "edge", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1432-L1473
train
dhermes/bezier
src/bezier/_surface_helpers.py
ignored_double_corner
def ignored_double_corner( intersection, tangent_s, tangent_t, edge_nodes1, edge_nodes2 ): """Check if an intersection is an "ignored" double corner. .. note:: This is a helper used only by :func:`ignored_corner`, which in turn is only used by :func:`classify_intersection`. Helper for :...
python
def ignored_double_corner( intersection, tangent_s, tangent_t, edge_nodes1, edge_nodes2 ): """Check if an intersection is an "ignored" double corner. .. note:: This is a helper used only by :func:`ignored_corner`, which in turn is only used by :func:`classify_intersection`. Helper for :...
[ "def", "ignored_double_corner", "(", "intersection", ",", "tangent_s", ",", "tangent_t", ",", "edge_nodes1", ",", "edge_nodes2", ")", ":", "# Compute the other edge for the ``s`` surface.", "prev_index", "=", "(", "intersection", ".", "index_first", "-", "1", ")", "%"...
Check if an intersection is an "ignored" double corner. .. note:: This is a helper used only by :func:`ignored_corner`, which in turn is only used by :func:`classify_intersection`. Helper for :func:`ignored_corner` where both ``s`` and ``t`` are ``0``. Does so by checking if either edg...
[ "Check", "if", "an", "intersection", "is", "an", "ignored", "double", "corner", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1476-L1558
train
dhermes/bezier
src/bezier/_surface_helpers.py
ignored_corner
def ignored_corner( intersection, tangent_s, tangent_t, edge_nodes1, edge_nodes2 ): """Check if an intersection is an "ignored" corner. .. note:: This is a helper used only by :func:`classify_intersection`. An "ignored" corner is one where the surfaces just "kiss" at the point of intersect...
python
def ignored_corner( intersection, tangent_s, tangent_t, edge_nodes1, edge_nodes2 ): """Check if an intersection is an "ignored" corner. .. note:: This is a helper used only by :func:`classify_intersection`. An "ignored" corner is one where the surfaces just "kiss" at the point of intersect...
[ "def", "ignored_corner", "(", "intersection", ",", "tangent_s", ",", "tangent_t", ",", "edge_nodes1", ",", "edge_nodes2", ")", ":", "if", "intersection", ".", "s", "==", "0.0", ":", "if", "intersection", ".", "t", "==", "0.0", ":", "# Double corner.", "retur...
Check if an intersection is an "ignored" corner. .. note:: This is a helper used only by :func:`classify_intersection`. An "ignored" corner is one where the surfaces just "kiss" at the point of intersection but their interiors do not meet. We can determine this by comparing the tangent lines ...
[ "Check", "if", "an", "intersection", "is", "an", "ignored", "corner", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1561-L1617
train
dhermes/bezier
src/bezier/_surface_helpers.py
classify_intersection
def classify_intersection(intersection, edge_nodes1, edge_nodes2): r"""Determine which curve is on the "inside of the intersection". .. note:: This is a helper used only by :meth:`.Surface.intersect`. This is intended to be a helper for forming a :class:`.CurvedPolygon` from the edge intersect...
python
def classify_intersection(intersection, edge_nodes1, edge_nodes2): r"""Determine which curve is on the "inside of the intersection". .. note:: This is a helper used only by :meth:`.Surface.intersect`. This is intended to be a helper for forming a :class:`.CurvedPolygon` from the edge intersect...
[ "def", "classify_intersection", "(", "intersection", ",", "edge_nodes1", ",", "edge_nodes2", ")", ":", "if", "intersection", ".", "s", "==", "1.0", "or", "intersection", ".", "t", "==", "1.0", ":", "raise", "ValueError", "(", "\"Intersection occurs at the end of a...
r"""Determine which curve is on the "inside of the intersection". .. note:: This is a helper used only by :meth:`.Surface.intersect`. This is intended to be a helper for forming a :class:`.CurvedPolygon` from the edge intersections of two :class:`.Surface`-s. In order to move from one intersec...
[ "r", "Determine", "which", "curve", "is", "on", "the", "inside", "of", "the", "intersection", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1620-L2096
train
dhermes/bezier
src/bezier/_surface_helpers.py
handle_ends
def handle_ends(index1, s, index2, t): """Updates intersection parameters if it is on the end of an edge. .. note:: This is a helper used only by :meth:`.Surface.intersect`. Does nothing if the intersection happens in the middle of two edges. If the intersection occurs at the end of the f...
python
def handle_ends(index1, s, index2, t): """Updates intersection parameters if it is on the end of an edge. .. note:: This is a helper used only by :meth:`.Surface.intersect`. Does nothing if the intersection happens in the middle of two edges. If the intersection occurs at the end of the f...
[ "def", "handle_ends", "(", "index1", ",", "s", ",", "index2", ",", "t", ")", ":", "edge_end", "=", "False", "if", "s", "==", "1.0", ":", "s", "=", "0.0", "index1", "=", "(", "index1", "+", "1", ")", "%", "3", "edge_end", "=", "True", "# NOTE: Thi...
Updates intersection parameters if it is on the end of an edge. .. note:: This is a helper used only by :meth:`.Surface.intersect`. Does nothing if the intersection happens in the middle of two edges. If the intersection occurs at the end of the first curve, moves it to the beginning of t...
[ "Updates", "intersection", "parameters", "if", "it", "is", "on", "the", "end", "of", "an", "edge", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2099-L2145
train
dhermes/bezier
src/bezier/_surface_helpers.py
to_front
def to_front(intersection, intersections, unused): """Rotates a node to the "front". .. note:: This is a helper used only by :func:`basic_interior_combine`, which in turn is only used by :func:`combine_intersections`. If a node is at the end of a segment, moves it to the beginning of th...
python
def to_front(intersection, intersections, unused): """Rotates a node to the "front". .. note:: This is a helper used only by :func:`basic_interior_combine`, which in turn is only used by :func:`combine_intersections`. If a node is at the end of a segment, moves it to the beginning of th...
[ "def", "to_front", "(", "intersection", ",", "intersections", ",", "unused", ")", ":", "if", "intersection", ".", "s", "==", "1.0", ":", "next_index", "=", "(", "intersection", ".", "index_first", "+", "1", ")", "%", "3", "# Make sure we haven't accidentally i...
Rotates a node to the "front". .. note:: This is a helper used only by :func:`basic_interior_combine`, which in turn is only used by :func:`combine_intersections`. If a node is at the end of a segment, moves it to the beginning of the next segment (at the exact same point). We assume that ...
[ "Rotates", "a", "node", "to", "the", "front", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2148-L2213
train
dhermes/bezier
src/bezier/_surface_helpers.py
get_next_first
def get_next_first(intersection, intersections, to_end=True): """Gets the next node along the current (first) edge. .. note:: This is a helper used only by :func:`get_next`, which in turn is only used by :func:`basic_interior_combine`, which itself is only used by :func:`combine_intersect...
python
def get_next_first(intersection, intersections, to_end=True): """Gets the next node along the current (first) edge. .. note:: This is a helper used only by :func:`get_next`, which in turn is only used by :func:`basic_interior_combine`, which itself is only used by :func:`combine_intersect...
[ "def", "get_next_first", "(", "intersection", ",", "intersections", ",", "to_end", "=", "True", ")", ":", "along_edge", "=", "None", "index_first", "=", "intersection", ".", "index_first", "s", "=", "intersection", ".", "s", "for", "other_int", "in", "intersec...
Gets the next node along the current (first) edge. .. note:: This is a helper used only by :func:`get_next`, which in turn is only used by :func:`basic_interior_combine`, which itself is only used by :func:`combine_intersections`. Along with :func:`get_next_second`, this function does th...
[ "Gets", "the", "next", "node", "along", "the", "current", "(", "first", ")", "edge", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2216-L2269
train
dhermes/bezier
src/bezier/_surface_helpers.py
get_next_second
def get_next_second(intersection, intersections, to_end=True): """Gets the next node along the current (second) edge. .. note:: This is a helper used only by :func:`get_next`, which in turn is only used by :func:`basic_interior_combine`, which itself is only used by :func:`combine_interse...
python
def get_next_second(intersection, intersections, to_end=True): """Gets the next node along the current (second) edge. .. note:: This is a helper used only by :func:`get_next`, which in turn is only used by :func:`basic_interior_combine`, which itself is only used by :func:`combine_interse...
[ "def", "get_next_second", "(", "intersection", ",", "intersections", ",", "to_end", "=", "True", ")", ":", "along_edge", "=", "None", "index_second", "=", "intersection", ".", "index_second", "t", "=", "intersection", ".", "t", "for", "other_int", "in", "inter...
Gets the next node along the current (second) edge. .. note:: This is a helper used only by :func:`get_next`, which in turn is only used by :func:`basic_interior_combine`, which itself is only used by :func:`combine_intersections`. Along with :func:`get_next_first`, this function does th...
[ "Gets", "the", "next", "node", "along", "the", "current", "(", "second", ")", "edge", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2272-L2325
train
dhermes/bezier
src/bezier/_surface_helpers.py
get_next_coincident
def get_next_coincident(intersection, intersections): """Gets the next node along the current (coincident) edge. .. note:: This is a helper used only by :func:`get_next`, which in turn is only used by :func:`basic_interior_combine`, which itself is only used by :func:`combine_intersection...
python
def get_next_coincident(intersection, intersections): """Gets the next node along the current (coincident) edge. .. note:: This is a helper used only by :func:`get_next`, which in turn is only used by :func:`basic_interior_combine`, which itself is only used by :func:`combine_intersection...
[ "def", "get_next_coincident", "(", "intersection", ",", "intersections", ")", ":", "# Moving along the first or second edge will produce the same result, but", "# since we \"rotate\" all intersections to the beginning of an edge, the", "# index may not match the first or second (or both).", "a...
Gets the next node along the current (coincident) edge. .. note:: This is a helper used only by :func:`get_next`, which in turn is only used by :func:`basic_interior_combine`, which itself is only used by :func:`combine_intersections`. Along with :func:`get_next_first` and :func:`get_nex...
[ "Gets", "the", "next", "node", "along", "the", "current", "(", "coincident", ")", "edge", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2328-L2384
train
dhermes/bezier
src/bezier/_surface_helpers.py
get_next
def get_next(intersection, intersections, unused): """Gets the next node along a given edge. .. note:: This is a helper used only by :func:`basic_interior_combine`, which in turn is only used by :func:`combine_intersections`. This function does the majority of the heavy lifting for :func:...
python
def get_next(intersection, intersections, unused): """Gets the next node along a given edge. .. note:: This is a helper used only by :func:`basic_interior_combine`, which in turn is only used by :func:`combine_intersections`. This function does the majority of the heavy lifting for :func:...
[ "def", "get_next", "(", "intersection", ",", "intersections", ",", "unused", ")", ":", "result", "=", "None", "if", "is_first", "(", "intersection", ".", "interior_curve", ")", ":", "result", "=", "get_next_first", "(", "intersection", ",", "intersections", ")...
Gets the next node along a given edge. .. note:: This is a helper used only by :func:`basic_interior_combine`, which in turn is only used by :func:`combine_intersections`. This function does the majority of the heavy lifting for :func:`basic_interior_combine`. .. note:: This fun...
[ "Gets", "the", "next", "node", "along", "a", "given", "edge", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2419-L2472
train
dhermes/bezier
src/bezier/_surface_helpers.py
ends_to_curve
def ends_to_curve(start_node, end_node): """Convert a "pair" of intersection nodes to a curve segment. .. note:: This is a helper used only by :func:`basic_interior_combine`, which in turn is only used by :func:`combine_intersections`. .. note:: This function could specialize to the...
python
def ends_to_curve(start_node, end_node): """Convert a "pair" of intersection nodes to a curve segment. .. note:: This is a helper used only by :func:`basic_interior_combine`, which in turn is only used by :func:`combine_intersections`. .. note:: This function could specialize to the...
[ "def", "ends_to_curve", "(", "start_node", ",", "end_node", ")", ":", "if", "is_first", "(", "start_node", ".", "interior_curve", ")", ":", "if", "end_node", ".", "index_first", "!=", "start_node", ".", "index_first", ":", "raise", "ValueError", "(", "_WRONG_C...
Convert a "pair" of intersection nodes to a curve segment. .. note:: This is a helper used only by :func:`basic_interior_combine`, which in turn is only used by :func:`combine_intersections`. .. note:: This function could specialize to the first or second segment attached to ``st...
[ "Convert", "a", "pair", "of", "intersection", "nodes", "to", "a", "curve", "segment", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2475-L2548
train
dhermes/bezier
src/bezier/_surface_helpers.py
no_intersections
def no_intersections(nodes1, degree1, nodes2, degree2): r"""Determine if one surface is in the other. Helper for :func:`combine_intersections` that handles the case of no points of intersection. In this case, either the surfaces are disjoint or one is fully contained in the other. To check contain...
python
def no_intersections(nodes1, degree1, nodes2, degree2): r"""Determine if one surface is in the other. Helper for :func:`combine_intersections` that handles the case of no points of intersection. In this case, either the surfaces are disjoint or one is fully contained in the other. To check contain...
[ "def", "no_intersections", "(", "nodes1", ",", "degree1", ",", "nodes2", ",", "degree2", ")", ":", "# NOTE: This is a circular import.", "from", "bezier", "import", "_surface_intersection", "located", "=", "_surface_intersection", ".", "locate_point", "(", "nodes2", "...
r"""Determine if one surface is in the other. Helper for :func:`combine_intersections` that handles the case of no points of intersection. In this case, either the surfaces are disjoint or one is fully contained in the other. To check containment, it's enough to check if one of the corners is cont...
[ "r", "Determine", "if", "one", "surface", "is", "in", "the", "other", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2551-L2591
train
dhermes/bezier
src/bezier/_surface_helpers.py
tangent_only_intersections
def tangent_only_intersections(all_types): """Determine intersection in the case of only-tangent intersections. If the only intersections are tangencies, then either the surfaces are tangent but don't meet ("kissing" edges) or one surface is internally tangent to the other. Thus we expect every in...
python
def tangent_only_intersections(all_types): """Determine intersection in the case of only-tangent intersections. If the only intersections are tangencies, then either the surfaces are tangent but don't meet ("kissing" edges) or one surface is internally tangent to the other. Thus we expect every in...
[ "def", "tangent_only_intersections", "(", "all_types", ")", ":", "if", "len", "(", "all_types", ")", "!=", "1", ":", "raise", "ValueError", "(", "\"Unexpected value, types should all match\"", ",", "all_types", ")", "point_type", "=", "all_types", ".", "pop", "(",...
Determine intersection in the case of only-tangent intersections. If the only intersections are tangencies, then either the surfaces are tangent but don't meet ("kissing" edges) or one surface is internally tangent to the other. Thus we expect every intersection to be classified as :attr:`~.Inters...
[ "Determine", "intersection", "in", "the", "case", "of", "only", "-", "tangent", "intersections", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2594-L2653
train
dhermes/bezier
src/bezier/_surface_helpers.py
basic_interior_combine
def basic_interior_combine(intersections, max_edges=10): """Combine intersections that don't involve tangencies. .. note:: This is a helper used only by :func:`combine_intersections`. .. note:: This helper assumes ``intersections`` isn't empty, but doesn't enforce it. Args: ...
python
def basic_interior_combine(intersections, max_edges=10): """Combine intersections that don't involve tangencies. .. note:: This is a helper used only by :func:`combine_intersections`. .. note:: This helper assumes ``intersections`` isn't empty, but doesn't enforce it. Args: ...
[ "def", "basic_interior_combine", "(", "intersections", ",", "max_edges", "=", "10", ")", ":", "unused", "=", "intersections", "[", ":", "]", "result", "=", "[", "]", "while", "unused", ":", "start", "=", "unused", ".", "pop", "(", ")", "curr_node", "=", ...
Combine intersections that don't involve tangencies. .. note:: This is a helper used only by :func:`combine_intersections`. .. note:: This helper assumes ``intersections`` isn't empty, but doesn't enforce it. Args: intersections (List[.Intersection]): Intersections from eac...
[ "Combine", "intersections", "that", "don", "t", "involve", "tangencies", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2656-L2723
train
dhermes/bezier
src/bezier/_surface_helpers.py
combine_intersections
def combine_intersections( intersections, nodes1, degree1, nodes2, degree2, all_types ): r"""Combine curve-curve intersections into curved polygon(s). .. note:: This is a helper used only by :meth:`.Surface.intersect`. Does so assuming each intersection lies on an edge of one of two :class...
python
def combine_intersections( intersections, nodes1, degree1, nodes2, degree2, all_types ): r"""Combine curve-curve intersections into curved polygon(s). .. note:: This is a helper used only by :meth:`.Surface.intersect`. Does so assuming each intersection lies on an edge of one of two :class...
[ "def", "combine_intersections", "(", "intersections", ",", "nodes1", ",", "degree1", ",", "nodes2", ",", "degree2", ",", "all_types", ")", ":", "if", "intersections", ":", "return", "basic_interior_combine", "(", "intersections", ")", "elif", "all_types", ":", "...
r"""Combine curve-curve intersections into curved polygon(s). .. note:: This is a helper used only by :meth:`.Surface.intersect`. Does so assuming each intersection lies on an edge of one of two :class:`.Surface`-s. .. note :: This assumes that each ``intersection`` has been classifie...
[ "r", "Combine", "curve", "-", "curve", "intersections", "into", "curved", "polygon", "(", "s", ")", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2726-L2773
train
dhermes/bezier
src/bezier/_surface_helpers.py
_evaluate_barycentric
def _evaluate_barycentric(nodes, degree, lambda1, lambda2, lambda3): r"""Compute a point on a surface. Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)` for a B |eacute| zier surface / triangle defined by ``nodes``. .. note:: There is also a Fortran implementation of this functio...
python
def _evaluate_barycentric(nodes, degree, lambda1, lambda2, lambda3): r"""Compute a point on a surface. Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)` for a B |eacute| zier surface / triangle defined by ``nodes``. .. note:: There is also a Fortran implementation of this functio...
[ "def", "_evaluate_barycentric", "(", "nodes", ",", "degree", ",", "lambda1", ",", "lambda2", ",", "lambda3", ")", ":", "dimension", ",", "num_nodes", "=", "nodes", ".", "shape", "binom_val", "=", "1.0", "result", "=", "np", ".", "zeros", "(", "(", "dimen...
r"""Compute a point on a surface. Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)` for a B |eacute| zier surface / triangle defined by ``nodes``. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes...
[ "r", "Compute", "a", "point", "on", "a", "surface", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2776-L2823
train
dhermes/bezier
src/bezier/_surface_helpers.py
_evaluate_barycentric_multi
def _evaluate_barycentric_multi(nodes, degree, param_vals, dimension): r"""Compute multiple points on the surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define t...
python
def _evaluate_barycentric_multi(nodes, degree, param_vals, dimension): r"""Compute multiple points on the surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define t...
[ "def", "_evaluate_barycentric_multi", "(", "nodes", ",", "degree", ",", "param_vals", ",", "dimension", ")", ":", "num_vals", ",", "_", "=", "param_vals", ".", "shape", "result", "=", "np", ".", "empty", "(", "(", "dimension", ",", "num_vals", ")", ",", ...
r"""Compute multiple points on the surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define the surface. degree (int): The degree of the surface define by ``nod...
[ "r", "Compute", "multiple", "points", "on", "the", "surface", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2826-L2852
train
dhermes/bezier
src/bezier/_surface_helpers.py
_evaluate_cartesian_multi
def _evaluate_cartesian_multi(nodes, degree, param_vals, dimension): r"""Compute multiple points on the surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define the...
python
def _evaluate_cartesian_multi(nodes, degree, param_vals, dimension): r"""Compute multiple points on the surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define the...
[ "def", "_evaluate_cartesian_multi", "(", "nodes", ",", "degree", ",", "param_vals", ",", "dimension", ")", ":", "num_vals", ",", "_", "=", "param_vals", ".", "shape", "result", "=", "np", ".", "empty", "(", "(", "dimension", ",", "num_vals", ")", ",", "o...
r"""Compute multiple points on the surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define the surface. degree (int): The degree of the surface define by ``nod...
[ "r", "Compute", "multiple", "points", "on", "the", "surface", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2855-L2881
train
dhermes/bezier
src/bezier/_surface_helpers.py
_compute_edge_nodes
def _compute_edge_nodes(nodes, degree): """Compute the nodes of each edges of a surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define the surface. degree...
python
def _compute_edge_nodes(nodes, degree): """Compute the nodes of each edges of a surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define the surface. degree...
[ "def", "_compute_edge_nodes", "(", "nodes", ",", "degree", ")", ":", "dimension", ",", "_", "=", "np", ".", "shape", "(", "nodes", ")", "nodes1", "=", "np", ".", "empty", "(", "(", "dimension", ",", "degree", "+", "1", ")", ",", "order", "=", "\"F\...
Compute the nodes of each edges of a surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define the surface. degree (int): The degree of the surface define by ``n...
[ "Compute", "the", "nodes", "of", "each", "edges", "of", "a", "surface", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2884-L2913
train
dhermes/bezier
src/bezier/_surface_helpers.py
shoelace_for_area
def shoelace_for_area(nodes): r"""Compute an auxiliary "shoelace" sum used to compute area. .. note:: This is a helper for :func:`_compute_area`. Defining :math:`\left[i, j\right] = x_i y_j - y_i x_j` as a shoelace term illuminates the name of this helper. On a degree one curve, this funct...
python
def shoelace_for_area(nodes): r"""Compute an auxiliary "shoelace" sum used to compute area. .. note:: This is a helper for :func:`_compute_area`. Defining :math:`\left[i, j\right] = x_i y_j - y_i x_j` as a shoelace term illuminates the name of this helper. On a degree one curve, this funct...
[ "def", "shoelace_for_area", "(", "nodes", ")", ":", "_", ",", "num_nodes", "=", "nodes", ".", "shape", "if", "num_nodes", "==", "2", ":", "shoelace", "=", "SHOELACE_LINEAR", "scale_factor", "=", "2.0", "elif", "num_nodes", "==", "3", ":", "shoelace", "=", ...
r"""Compute an auxiliary "shoelace" sum used to compute area. .. note:: This is a helper for :func:`_compute_area`. Defining :math:`\left[i, j\right] = x_i y_j - y_i x_j` as a shoelace term illuminates the name of this helper. On a degree one curve, this function will return .. math:: ...
[ "r", "Compute", "an", "auxiliary", "shoelace", "sum", "used", "to", "compute", "area", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2916-L2973
train
dhermes/bezier
docs/make_images.py
save_image
def save_image(figure, filename): """Save an image to the docs images directory. Args: filename (str): The name of the file (not containing directory info). """ path = os.path.join(IMAGES_DIR, filename) figure.savefig(path, bbox_inches="tight") plt.close(figure)
python
def save_image(figure, filename): """Save an image to the docs images directory. Args: filename (str): The name of the file (not containing directory info). """ path = os.path.join(IMAGES_DIR, filename) figure.savefig(path, bbox_inches="tight") plt.close(figure)
[ "def", "save_image", "(", "figure", ",", "filename", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "IMAGES_DIR", ",", "filename", ")", "figure", ".", "savefig", "(", "path", ",", "bbox_inches", "=", "\"tight\"", ")", "plt", ".", "close", ...
Save an image to the docs images directory. Args: filename (str): The name of the file (not containing directory info).
[ "Save", "an", "image", "to", "the", "docs", "images", "directory", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L48-L57
train
dhermes/bezier
docs/make_images.py
stack1d
def stack1d(*points): """Fill out the columns of matrix with a series of points. This is because ``np.hstack()`` will just make another 1D vector out of them and ``np.vstack()`` will put them in the rows. Args: points (Tuple[numpy.ndarray, ...]): Tuple of 1D points (i.e. arrays wit...
python
def stack1d(*points): """Fill out the columns of matrix with a series of points. This is because ``np.hstack()`` will just make another 1D vector out of them and ``np.vstack()`` will put them in the rows. Args: points (Tuple[numpy.ndarray, ...]): Tuple of 1D points (i.e. arrays wit...
[ "def", "stack1d", "(", "*", "points", ")", ":", "result", "=", "np", ".", "empty", "(", "(", "2", ",", "len", "(", "points", ")", ")", ",", "order", "=", "\"F\"", ")", "for", "index", ",", "point", "in", "enumerate", "(", "points", ")", ":", "r...
Fill out the columns of matrix with a series of points. This is because ``np.hstack()`` will just make another 1D vector out of them and ``np.vstack()`` will put them in the rows. Args: points (Tuple[numpy.ndarray, ...]): Tuple of 1D points (i.e. arrays with shape ``(2,)``. Return...
[ "Fill", "out", "the", "columns", "of", "matrix", "with", "a", "series", "of", "points", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L60-L77
train
dhermes/bezier
docs/make_images.py
linearization_error
def linearization_error(nodes): """Image for :func:`.linearization_error` docstring.""" if NO_IMAGES: return curve = bezier.Curve.from_nodes(nodes) line = bezier.Curve.from_nodes(nodes[:, (0, -1)]) midpoints = np.hstack([curve.evaluate(0.5), line.evaluate(0.5)]) ax = curve.plot(256) ...
python
def linearization_error(nodes): """Image for :func:`.linearization_error` docstring.""" if NO_IMAGES: return curve = bezier.Curve.from_nodes(nodes) line = bezier.Curve.from_nodes(nodes[:, (0, -1)]) midpoints = np.hstack([curve.evaluate(0.5), line.evaluate(0.5)]) ax = curve.plot(256) ...
[ "def", "linearization_error", "(", "nodes", ")", ":", "if", "NO_IMAGES", ":", "return", "curve", "=", "bezier", ".", "Curve", ".", "from_nodes", "(", "nodes", ")", "line", "=", "bezier", ".", "Curve", ".", "from_nodes", "(", "nodes", "[", ":", ",", "("...
Image for :func:`.linearization_error` docstring.
[ "Image", "for", ":", "func", ":", ".", "linearization_error", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L80-L94
train
dhermes/bezier
docs/make_images.py
newton_refine1
def newton_refine1(s, new_s, curve1, t, new_t, curve2): """Image for :func:`.newton_refine` docstring.""" if NO_IMAGES: return points = np.hstack([curve1.evaluate(s), curve2.evaluate(t)]) points_new = np.hstack([curve1.evaluate(new_s), curve2.evaluate(new_t)]) ax = curve1.plot(256) curv...
python
def newton_refine1(s, new_s, curve1, t, new_t, curve2): """Image for :func:`.newton_refine` docstring.""" if NO_IMAGES: return points = np.hstack([curve1.evaluate(s), curve2.evaluate(t)]) points_new = np.hstack([curve1.evaluate(new_s), curve2.evaluate(new_t)]) ax = curve1.plot(256) curv...
[ "def", "newton_refine1", "(", "s", ",", "new_s", ",", "curve1", ",", "t", ",", "new_t", ",", "curve2", ")", ":", "if", "NO_IMAGES", ":", "return", "points", "=", "np", ".", "hstack", "(", "[", "curve1", ".", "evaluate", "(", "s", ")", ",", "curve2"...
Image for :func:`.newton_refine` docstring.
[ "Image", "for", ":", "func", ":", ".", "newton_refine", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L97-L123
train
dhermes/bezier
docs/make_images.py
newton_refine2
def newton_refine2(s_vals, curve1, curve2): """Image for :func:`.newton_refine` docstring.""" if NO_IMAGES: return ax = curve1.plot(256) ax.lines[-1].zorder = 1 curve2.plot(256, ax=ax) ax.lines[-1].zorder = 1 points = curve1.evaluate_multi(np.asfortranarray(s_vals)) colors = sea...
python
def newton_refine2(s_vals, curve1, curve2): """Image for :func:`.newton_refine` docstring.""" if NO_IMAGES: return ax = curve1.plot(256) ax.lines[-1].zorder = 1 curve2.plot(256, ax=ax) ax.lines[-1].zorder = 1 points = curve1.evaluate_multi(np.asfortranarray(s_vals)) colors = sea...
[ "def", "newton_refine2", "(", "s_vals", ",", "curve1", ",", "curve2", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curve1", ".", "plot", "(", "256", ")", "ax", ".", "lines", "[", "-", "1", "]", ".", "zorder", "=", "1", "curve2", ".", "...
Image for :func:`.newton_refine` docstring.
[ "Image", "for", ":", "func", ":", ".", "newton_refine", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L126-L143
train
dhermes/bezier
docs/make_images.py
segment_intersection1
def segment_intersection1(start0, end0, start1, end1, s): """Image for :func:`.segment_intersection` docstring.""" if NO_IMAGES: return line0 = bezier.Curve.from_nodes(stack1d(start0, end0)) line1 = bezier.Curve.from_nodes(stack1d(start1, end1)) ax = line0.plot(2) line1.plot(256, ax=ax)...
python
def segment_intersection1(start0, end0, start1, end1, s): """Image for :func:`.segment_intersection` docstring.""" if NO_IMAGES: return line0 = bezier.Curve.from_nodes(stack1d(start0, end0)) line1 = bezier.Curve.from_nodes(stack1d(start1, end1)) ax = line0.plot(2) line1.plot(256, ax=ax)...
[ "def", "segment_intersection1", "(", "start0", ",", "end0", ",", "start1", ",", "end1", ",", "s", ")", ":", "if", "NO_IMAGES", ":", "return", "line0", "=", "bezier", ".", "Curve", ".", "from_nodes", "(", "stack1d", "(", "start0", ",", "end0", ")", ")",...
Image for :func:`.segment_intersection` docstring.
[ "Image", "for", ":", "func", ":", ".", "segment_intersection", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L166-L178
train
dhermes/bezier
docs/make_images.py
segment_intersection2
def segment_intersection2(start0, end0, start1, end1): """Image for :func:`.segment_intersection` docstring.""" if NO_IMAGES: return line0 = bezier.Curve.from_nodes(stack1d(start0, end0)) line1 = bezier.Curve.from_nodes(stack1d(start1, end1)) ax = line0.plot(2) line1.plot(2, ax=ax) ...
python
def segment_intersection2(start0, end0, start1, end1): """Image for :func:`.segment_intersection` docstring.""" if NO_IMAGES: return line0 = bezier.Curve.from_nodes(stack1d(start0, end0)) line1 = bezier.Curve.from_nodes(stack1d(start1, end1)) ax = line0.plot(2) line1.plot(2, ax=ax) ...
[ "def", "segment_intersection2", "(", "start0", ",", "end0", ",", "start1", ",", "end1", ")", ":", "if", "NO_IMAGES", ":", "return", "line0", "=", "bezier", ".", "Curve", ".", "from_nodes", "(", "stack1d", "(", "start0", ",", "end0", ")", ")", "line1", ...
Image for :func:`.segment_intersection` docstring.
[ "Image", "for", ":", "func", ":", ".", "segment_intersection", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L181-L191
train
dhermes/bezier
docs/make_images.py
helper_parallel_lines
def helper_parallel_lines(start0, end0, start1, end1, filename): """Image for :func:`.parallel_lines_parameters` docstring.""" if NO_IMAGES: return figure = plt.figure() ax = figure.gca() points = stack1d(start0, end0, start1, end1) ax.plot(points[0, :2], points[1, :2], marker="o") ...
python
def helper_parallel_lines(start0, end0, start1, end1, filename): """Image for :func:`.parallel_lines_parameters` docstring.""" if NO_IMAGES: return figure = plt.figure() ax = figure.gca() points = stack1d(start0, end0, start1, end1) ax.plot(points[0, :2], points[1, :2], marker="o") ...
[ "def", "helper_parallel_lines", "(", "start0", ",", "end0", ",", "start1", ",", "end1", ",", "filename", ")", ":", "if", "NO_IMAGES", ":", "return", "figure", "=", "plt", ".", "figure", "(", ")", "ax", "=", "figure", ".", "gca", "(", ")", "points", "...
Image for :func:`.parallel_lines_parameters` docstring.
[ "Image", "for", ":", "func", ":", ".", "parallel_lines_parameters", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L194-L206
train
dhermes/bezier
docs/make_images.py
curve_constructor
def curve_constructor(curve): """Image for :class`.Curve` docstring.""" if NO_IMAGES: return ax = curve.plot(256) line = ax.lines[0] nodes = curve._nodes ax.plot( nodes[0, :], nodes[1, :], color="black", linestyle="None", marker="o" ) add_patch(ax, nodes, line.get_color(...
python
def curve_constructor(curve): """Image for :class`.Curve` docstring.""" if NO_IMAGES: return ax = curve.plot(256) line = ax.lines[0] nodes = curve._nodes ax.plot( nodes[0, :], nodes[1, :], color="black", linestyle="None", marker="o" ) add_patch(ax, nodes, line.get_color(...
[ "def", "curve_constructor", "(", "curve", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curve", ".", "plot", "(", "256", ")", "line", "=", "ax", ".", "lines", "[", "0", "]", "nodes", "=", "curve", ".", "_nodes", "ax", ".", "plot", "(", ...
Image for :class`.Curve` docstring.
[ "Image", "for", ":", "class", ".", "Curve", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L227-L242
train
dhermes/bezier
docs/make_images.py
curve_evaluate
def curve_evaluate(curve): """Image for :meth`.Curve.evaluate` docstring.""" if NO_IMAGES: return ax = curve.plot(256) points = curve.evaluate_multi(np.asfortranarray([0.75])) ax.plot( points[0, :], points[1, :], color="black", linestyle="None", marker="o" ) ax.axis("scaled"...
python
def curve_evaluate(curve): """Image for :meth`.Curve.evaluate` docstring.""" if NO_IMAGES: return ax = curve.plot(256) points = curve.evaluate_multi(np.asfortranarray([0.75])) ax.plot( points[0, :], points[1, :], color="black", linestyle="None", marker="o" ) ax.axis("scaled"...
[ "def", "curve_evaluate", "(", "curve", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curve", ".", "plot", "(", "256", ")", "points", "=", "curve", ".", "evaluate_multi", "(", "np", ".", "asfortranarray", "(", "[", "0.75", "]", ")", ")", "ax...
Image for :meth`.Curve.evaluate` docstring.
[ "Image", "for", ":", "meth", ".", "Curve", ".", "evaluate", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L245-L258
train
dhermes/bezier
docs/make_images.py
curve_subdivide
def curve_subdivide(curve, left, right): """Image for :meth`.Curve.subdivide` docstring.""" if NO_IMAGES: return figure = plt.figure() ax = figure.gca() add_patch(ax, curve._nodes, "gray") ax = left.plot(256, ax=ax) line = ax.lines[-1] add_patch(ax, left._nodes, line.get_color()...
python
def curve_subdivide(curve, left, right): """Image for :meth`.Curve.subdivide` docstring.""" if NO_IMAGES: return figure = plt.figure() ax = figure.gca() add_patch(ax, curve._nodes, "gray") ax = left.plot(256, ax=ax) line = ax.lines[-1] add_patch(ax, left._nodes, line.get_color()...
[ "def", "curve_subdivide", "(", "curve", ",", "left", ",", "right", ")", ":", "if", "NO_IMAGES", ":", "return", "figure", "=", "plt", ".", "figure", "(", ")", "ax", "=", "figure", ".", "gca", "(", ")", "add_patch", "(", "ax", ",", "curve", ".", "_no...
Image for :meth`.Curve.subdivide` docstring.
[ "Image", "for", ":", "meth", ".", "Curve", ".", "subdivide", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L261-L278
train
dhermes/bezier
docs/make_images.py
curve_intersect
def curve_intersect(curve1, curve2, s_vals): """Image for :meth`.Curve.intersect` docstring.""" if NO_IMAGES: return ax = curve1.plot(256) curve2.plot(256, ax=ax) intersections = curve1.evaluate_multi(s_vals) ax.plot( intersections[0, :], intersections[1, :], col...
python
def curve_intersect(curve1, curve2, s_vals): """Image for :meth`.Curve.intersect` docstring.""" if NO_IMAGES: return ax = curve1.plot(256) curve2.plot(256, ax=ax) intersections = curve1.evaluate_multi(s_vals) ax.plot( intersections[0, :], intersections[1, :], col...
[ "def", "curve_intersect", "(", "curve1", ",", "curve2", ",", "s_vals", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curve1", ".", "plot", "(", "256", ")", "curve2", ".", "plot", "(", "256", ",", "ax", "=", "ax", ")", "intersections", "=", ...
Image for :meth`.Curve.intersect` docstring.
[ "Image", "for", ":", "meth", ".", "Curve", ".", "intersect", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L281-L299
train
dhermes/bezier
docs/make_images.py
surface_constructor
def surface_constructor(surface): """Image for :class`.Surface` docstring.""" if NO_IMAGES: return ax = surface.plot(256, with_nodes=True) line = ax.lines[0] nodes = surface._nodes add_patch(ax, nodes[:, (0, 1, 2, 5)], line.get_color()) delta = 1.0 / 32.0 ax.text( nodes[...
python
def surface_constructor(surface): """Image for :class`.Surface` docstring.""" if NO_IMAGES: return ax = surface.plot(256, with_nodes=True) line = ax.lines[0] nodes = surface._nodes add_patch(ax, nodes[:, (0, 1, 2, 5)], line.get_color()) delta = 1.0 / 32.0 ax.text( nodes[...
[ "def", "surface_constructor", "(", "surface", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "surface", ".", "plot", "(", "256", ",", "with_nodes", "=", "True", ")", "line", "=", "ax", ".", "lines", "[", "0", "]", "nodes", "=", "surface", "."...
Image for :class`.Surface` docstring.
[ "Image", "for", ":", "class", ".", "Surface", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L302-L363
train
dhermes/bezier
docs/make_images.py
surface_evaluate_barycentric
def surface_evaluate_barycentric(surface, point): """Image for :meth`.Surface.evaluate_barycentric` docstring.""" if NO_IMAGES: return ax = surface.plot(256) ax.plot( point[0, :], point[1, :], color="black", linestyle="None", marker="o" ) ax.axis("scaled") ax.set_xlim(-0.125...
python
def surface_evaluate_barycentric(surface, point): """Image for :meth`.Surface.evaluate_barycentric` docstring.""" if NO_IMAGES: return ax = surface.plot(256) ax.plot( point[0, :], point[1, :], color="black", linestyle="None", marker="o" ) ax.axis("scaled") ax.set_xlim(-0.125...
[ "def", "surface_evaluate_barycentric", "(", "surface", ",", "point", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "surface", ".", "plot", "(", "256", ")", "ax", ".", "plot", "(", "point", "[", "0", ",", ":", "]", ",", "point", "[", "1", "...
Image for :meth`.Surface.evaluate_barycentric` docstring.
[ "Image", "for", ":", "meth", ".", "Surface", ".", "evaluate_barycentric", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L366-L378
train
dhermes/bezier
docs/make_images.py
surface_evaluate_cartesian_multi
def surface_evaluate_cartesian_multi(surface, points): """Image for :meth`.Surface.evaluate_cartesian_multi` docstring.""" if NO_IMAGES: return ax = surface.plot(256) ax.plot( points[0, :], points[1, :], color="black", linestyle="None", marker="o" ) delta = 1.0 / 32.0 font_s...
python
def surface_evaluate_cartesian_multi(surface, points): """Image for :meth`.Surface.evaluate_cartesian_multi` docstring.""" if NO_IMAGES: return ax = surface.plot(256) ax.plot( points[0, :], points[1, :], color="black", linestyle="None", marker="o" ) delta = 1.0 / 32.0 font_s...
[ "def", "surface_evaluate_cartesian_multi", "(", "surface", ",", "points", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "surface", ".", "plot", "(", "256", ")", "ax", ".", "plot", "(", "points", "[", "0", ",", ":", "]", ",", "points", "[", "...
Image for :meth`.Surface.evaluate_cartesian_multi` docstring.
[ "Image", "for", ":", "meth", ".", "Surface", ".", "evaluate_cartesian_multi", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L381-L419
train
dhermes/bezier
docs/make_images.py
surface_is_valid1
def surface_is_valid1(surface): """Image for :meth`.Surface.is_valid` docstring.""" if NO_IMAGES: return ax = surface.plot(256) ax.axis("scaled") ax.set_xlim(-0.125, 2.125) ax.set_ylim(-0.125, 2.125) save_image(ax.figure, "surface_is_valid1.png")
python
def surface_is_valid1(surface): """Image for :meth`.Surface.is_valid` docstring.""" if NO_IMAGES: return ax = surface.plot(256) ax.axis("scaled") ax.set_xlim(-0.125, 2.125) ax.set_ylim(-0.125, 2.125) save_image(ax.figure, "surface_is_valid1.png")
[ "def", "surface_is_valid1", "(", "surface", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "surface", ".", "plot", "(", "256", ")", "ax", ".", "axis", "(", "\"scaled\"", ")", "ax", ".", "set_xlim", "(", "-", "0.125", ",", "2.125", ")", "ax", ...
Image for :meth`.Surface.is_valid` docstring.
[ "Image", "for", ":", "meth", ".", "Surface", ".", "is_valid", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L471-L480
train
dhermes/bezier
docs/make_images.py
surface_is_valid3
def surface_is_valid3(surface): """Image for :meth`.Surface.is_valid` docstring.""" if NO_IMAGES: return edge1, edge2, edge3 = surface.edges N = 128 # Compute points on each edge. std_s = np.linspace(0.0, 1.0, N + 1) points1 = edge1.evaluate_multi(std_s) points2 = edge2.evaluate...
python
def surface_is_valid3(surface): """Image for :meth`.Surface.is_valid` docstring.""" if NO_IMAGES: return edge1, edge2, edge3 = surface.edges N = 128 # Compute points on each edge. std_s = np.linspace(0.0, 1.0, N + 1) points1 = edge1.evaluate_multi(std_s) points2 = edge2.evaluate...
[ "def", "surface_is_valid3", "(", "surface", ")", ":", "if", "NO_IMAGES", ":", "return", "edge1", ",", "edge2", ",", "edge3", "=", "surface", ".", "edges", "N", "=", "128", "# Compute points on each edge.", "std_s", "=", "np", ".", "linspace", "(", "0.0", "...
Image for :meth`.Surface.is_valid` docstring.
[ "Image", "for", ":", "meth", ".", "Surface", ".", "is_valid", "docstring", "." ]
4f941f82637a8e70a5b159a9203132192e23406b
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L495-L532
train