repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
0101/pipetools
pipetools/utils.py
take_until
def take_until(condition): """ >>> [1, 4, 6, 4, 1] > take_until(X > 5) | list [1, 4] >>> [1, 4, 6, 4, 1] > take_until(X > 5).including | list [1, 4, 6] """ f = partial(takewhile, pipe | condition | operator.not_) f.attrs = {'including': take_until_including(condition)} return f
python
def take_until(condition): """ >>> [1, 4, 6, 4, 1] > take_until(X > 5) | list [1, 4] >>> [1, 4, 6, 4, 1] > take_until(X > 5).including | list [1, 4, 6] """ f = partial(takewhile, pipe | condition | operator.not_) f.attrs = {'including': take_until_including(condition)} return f
[ "def", "take_until", "(", "condition", ")", ":", "f", "=", "partial", "(", "takewhile", ",", "pipe", "|", "condition", "|", "operator", ".", "not_", ")", "f", ".", "attrs", "=", "{", "'including'", ":", "take_until_including", "(", "condition", ")", "}",...
>>> [1, 4, 6, 4, 1] > take_until(X > 5) | list [1, 4] >>> [1, 4, 6, 4, 1] > take_until(X > 5).including | list [1, 4, 6]
[ ">>>", "[", "1", "4", "6", "4", "1", "]", ">", "take_until", "(", "X", ">", "5", ")", "|", "list", "[", "1", "4", "]" ]
train
https://github.com/0101/pipetools/blob/42f71af0ecaeacee0f3d64c8706ddb1caacf8bc1/pipetools/utils.py#L319-L329
0101/pipetools
pipetools/utils.py
take_until_including
def take_until_including(condition): """ >>> [1, 4, 6, 4, 1] > take_until_including(X > 5) | list [1, 4, 6] """ def take_until_including_(interable): for i in interable: if not condition(i): yield i else: yield i break ...
python
def take_until_including(condition): """ >>> [1, 4, 6, 4, 1] > take_until_including(X > 5) | list [1, 4, 6] """ def take_until_including_(interable): for i in interable: if not condition(i): yield i else: yield i break ...
[ "def", "take_until_including", "(", "condition", ")", ":", "def", "take_until_including_", "(", "interable", ")", ":", "for", "i", "in", "interable", ":", "if", "not", "condition", "(", "i", ")", ":", "yield", "i", "else", ":", "yield", "i", "break", "re...
>>> [1, 4, 6, 4, 1] > take_until_including(X > 5) | list [1, 4, 6]
[ ">>>", "[", "1", "4", "6", "4", "1", "]", ">", "take_until_including", "(", "X", ">", "5", ")", "|", "list", "[", "1", "4", "6", "]" ]
train
https://github.com/0101/pipetools/blob/42f71af0ecaeacee0f3d64c8706ddb1caacf8bc1/pipetools/utils.py#L334-L346
0101/pipetools
pipetools/main.py
xpartial
def xpartial(func, *xargs, **xkwargs): """ Like :func:`functools.partial`, but can take an :class:`XObject` placeholder that will be replaced with the first positional argument when the partially applied function is called. Useful when the function's positional arguments' order doesn't fit your ...
python
def xpartial(func, *xargs, **xkwargs): """ Like :func:`functools.partial`, but can take an :class:`XObject` placeholder that will be replaced with the first positional argument when the partially applied function is called. Useful when the function's positional arguments' order doesn't fit your ...
[ "def", "xpartial", "(", "func", ",", "*", "xargs", ",", "*", "*", "xkwargs", ")", ":", "any_x", "=", "any", "(", "isinstance", "(", "a", ",", "XObject", ")", "for", "a", "in", "xargs", "+", "tuple", "(", "xkwargs", ".", "values", "(", ")", ")", ...
Like :func:`functools.partial`, but can take an :class:`XObject` placeholder that will be replaced with the first positional argument when the partially applied function is called. Useful when the function's positional arguments' order doesn't fit your situation, e.g.: >>> reverse_range = xpartial...
[ "Like", ":", "func", ":", "functools", ".", "partial", "but", "can", "take", "an", ":", "class", ":", "XObject", "placeholder", "that", "will", "be", "replaced", "with", "the", "first", "positional", "argument", "when", "the", "partially", "applied", "functi...
train
https://github.com/0101/pipetools/blob/42f71af0ecaeacee0f3d64c8706ddb1caacf8bc1/pipetools/main.py#L207-L255
pytroll/pyorbital
pyorbital/astronomy.py
gmst
def gmst(utc_time): """Greenwich mean sidereal utc_time, in radians. As defined in the AIAA 2006 implementation: http://www.celestrak.com/publications/AIAA/2006-6753/ """ ut1 = jdays2000(utc_time) / 36525.0 theta = 67310.54841 + ut1 * (876600 * 3600 + 8640184.812866 + ut1 * ...
python
def gmst(utc_time): """Greenwich mean sidereal utc_time, in radians. As defined in the AIAA 2006 implementation: http://www.celestrak.com/publications/AIAA/2006-6753/ """ ut1 = jdays2000(utc_time) / 36525.0 theta = 67310.54841 + ut1 * (876600 * 3600 + 8640184.812866 + ut1 * ...
[ "def", "gmst", "(", "utc_time", ")", ":", "ut1", "=", "jdays2000", "(", "utc_time", ")", "/", "36525.0", "theta", "=", "67310.54841", "+", "ut1", "*", "(", "876600", "*", "3600", "+", "8640184.812866", "+", "ut1", "*", "(", "0.093104", "-", "ut1", "*...
Greenwich mean sidereal utc_time, in radians. As defined in the AIAA 2006 implementation: http://www.celestrak.com/publications/AIAA/2006-6753/
[ "Greenwich", "mean", "sidereal", "utc_time", "in", "radians", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/astronomy.py#L54-L63
pytroll/pyorbital
pyorbital/astronomy.py
sun_ecliptic_longitude
def sun_ecliptic_longitude(utc_time): """Ecliptic longitude of the sun at *utc_time*. """ jdate = jdays2000(utc_time) / 36525.0 # mean anomaly, rad m_a = np.deg2rad(357.52910 + 35999.05030 * jdate - 0.0001559 * jdate * jdate - 0.00000048...
python
def sun_ecliptic_longitude(utc_time): """Ecliptic longitude of the sun at *utc_time*. """ jdate = jdays2000(utc_time) / 36525.0 # mean anomaly, rad m_a = np.deg2rad(357.52910 + 35999.05030 * jdate - 0.0001559 * jdate * jdate - 0.00000048...
[ "def", "sun_ecliptic_longitude", "(", "utc_time", ")", ":", "jdate", "=", "jdays2000", "(", "utc_time", ")", "/", "36525.0", "# mean anomaly, rad", "m_a", "=", "np", ".", "deg2rad", "(", "357.52910", "+", "35999.05030", "*", "jdate", "-", "0.0001559", "*", "...
Ecliptic longitude of the sun at *utc_time*.
[ "Ecliptic", "longitude", "of", "the", "sun", "at", "*", "utc_time", "*", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/astronomy.py#L73-L88
pytroll/pyorbital
pyorbital/astronomy.py
sun_ra_dec
def sun_ra_dec(utc_time): """Right ascension and declination of the sun at *utc_time*. """ jdate = jdays2000(utc_time) / 36525.0 eps = np.deg2rad(23.0 + 26.0 / 60.0 + 21.448 / 3600.0 - (46.8150 * jdate + 0.00059 * jdate * jdate - 0.001813 * jdate * jdate * jdat...
python
def sun_ra_dec(utc_time): """Right ascension and declination of the sun at *utc_time*. """ jdate = jdays2000(utc_time) / 36525.0 eps = np.deg2rad(23.0 + 26.0 / 60.0 + 21.448 / 3600.0 - (46.8150 * jdate + 0.00059 * jdate * jdate - 0.001813 * jdate * jdate * jdat...
[ "def", "sun_ra_dec", "(", "utc_time", ")", ":", "jdate", "=", "jdays2000", "(", "utc_time", ")", "/", "36525.0", "eps", "=", "np", ".", "deg2rad", "(", "23.0", "+", "26.0", "/", "60.0", "+", "21.448", "/", "3600.0", "-", "(", "46.8150", "*", "jdate",...
Right ascension and declination of the sun at *utc_time*.
[ "Right", "ascension", "and", "declination", "of", "the", "sun", "at", "*", "utc_time", "*", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/astronomy.py#L91-L107
pytroll/pyorbital
pyorbital/astronomy.py
get_alt_az
def get_alt_az(utc_time, lon, lat): """Return sun altitude and azimuth from *utc_time*, *lon*, and *lat*. lon,lat in degrees What is the unit of the returned angles and heights!? FIXME! """ lon = np.deg2rad(lon) lat = np.deg2rad(lat) ra_, dec = sun_ra_dec(utc_time) h__ = _local_hour_ang...
python
def get_alt_az(utc_time, lon, lat): """Return sun altitude and azimuth from *utc_time*, *lon*, and *lat*. lon,lat in degrees What is the unit of the returned angles and heights!? FIXME! """ lon = np.deg2rad(lon) lat = np.deg2rad(lat) ra_, dec = sun_ra_dec(utc_time) h__ = _local_hour_ang...
[ "def", "get_alt_az", "(", "utc_time", ",", "lon", ",", "lat", ")", ":", "lon", "=", "np", ".", "deg2rad", "(", "lon", ")", "lat", "=", "np", ".", "deg2rad", "(", "lat", ")", "ra_", ",", "dec", "=", "sun_ra_dec", "(", "utc_time", ")", "h__", "=", ...
Return sun altitude and azimuth from *utc_time*, *lon*, and *lat*. lon,lat in degrees What is the unit of the returned angles and heights!? FIXME!
[ "Return", "sun", "altitude", "and", "azimuth", "from", "*", "utc_time", "*", "*", "lon", "*", "and", "*", "lat", "*", ".", "lon", "lat", "in", "degrees", "What", "is", "the", "unit", "of", "the", "returned", "angles", "and", "heights!?", "FIXME!" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/astronomy.py#L118-L131
pytroll/pyorbital
pyorbital/astronomy.py
cos_zen
def cos_zen(utc_time, lon, lat): """Cosine of the sun-zenith angle for *lon*, *lat* at *utc_time*. utc_time: datetime.datetime instance of the UTC time lon and lat in degrees. """ lon = np.deg2rad(lon) lat = np.deg2rad(lat) r_a, dec = sun_ra_dec(utc_time) h__ = _local_hour_angle(utc_tim...
python
def cos_zen(utc_time, lon, lat): """Cosine of the sun-zenith angle for *lon*, *lat* at *utc_time*. utc_time: datetime.datetime instance of the UTC time lon and lat in degrees. """ lon = np.deg2rad(lon) lat = np.deg2rad(lat) r_a, dec = sun_ra_dec(utc_time) h__ = _local_hour_angle(utc_tim...
[ "def", "cos_zen", "(", "utc_time", ",", "lon", ",", "lat", ")", ":", "lon", "=", "np", ".", "deg2rad", "(", "lon", ")", "lat", "=", "np", ".", "deg2rad", "(", "lat", ")", "r_a", ",", "dec", "=", "sun_ra_dec", "(", "utc_time", ")", "h__", "=", "...
Cosine of the sun-zenith angle for *lon*, *lat* at *utc_time*. utc_time: datetime.datetime instance of the UTC time lon and lat in degrees.
[ "Cosine", "of", "the", "sun", "-", "zenith", "angle", "for", "*", "lon", "*", "*", "lat", "*", "at", "*", "utc_time", "*", ".", "utc_time", ":", "datetime", ".", "datetime", "instance", "of", "the", "UTC", "time", "lon", "and", "lat", "in", "degrees"...
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/astronomy.py#L134-L144
pytroll/pyorbital
pyorbital/astronomy.py
sun_zenith_angle
def sun_zenith_angle(utc_time, lon, lat): """Sun-zenith angle for *lon*, *lat* at *utc_time*. lon,lat in degrees. The angle returned is given in degrees """ return np.rad2deg(np.arccos(cos_zen(utc_time, lon, lat)))
python
def sun_zenith_angle(utc_time, lon, lat): """Sun-zenith angle for *lon*, *lat* at *utc_time*. lon,lat in degrees. The angle returned is given in degrees """ return np.rad2deg(np.arccos(cos_zen(utc_time, lon, lat)))
[ "def", "sun_zenith_angle", "(", "utc_time", ",", "lon", ",", "lat", ")", ":", "return", "np", ".", "rad2deg", "(", "np", ".", "arccos", "(", "cos_zen", "(", "utc_time", ",", "lon", ",", "lat", ")", ")", ")" ]
Sun-zenith angle for *lon*, *lat* at *utc_time*. lon,lat in degrees. The angle returned is given in degrees
[ "Sun", "-", "zenith", "angle", "for", "*", "lon", "*", "*", "lat", "*", "at", "*", "utc_time", "*", ".", "lon", "lat", "in", "degrees", ".", "The", "angle", "returned", "is", "given", "in", "degrees" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/astronomy.py#L147-L152
pytroll/pyorbital
pyorbital/astronomy.py
sun_earth_distance_correction
def sun_earth_distance_correction(utc_time): """Calculate the sun earth distance correction, relative to 1 AU. """ year = 365.256363004 # This is computed from # http://curious.astro.cornell.edu/question.php?number=582 # AU = 149597870700.0 # a = 149598261000.0 # theta = (jdays2000(utc_t...
python
def sun_earth_distance_correction(utc_time): """Calculate the sun earth distance correction, relative to 1 AU. """ year = 365.256363004 # This is computed from # http://curious.astro.cornell.edu/question.php?number=582 # AU = 149597870700.0 # a = 149598261000.0 # theta = (jdays2000(utc_t...
[ "def", "sun_earth_distance_correction", "(", "utc_time", ")", ":", "year", "=", "365.256363004", "# This is computed from", "# http://curious.astro.cornell.edu/question.php?number=582", "# AU = 149597870700.0", "# a = 149598261000.0", "# theta = (jdays2000(utc_time) - 2) * (2 * np.pi) / ye...
Calculate the sun earth distance correction, relative to 1 AU.
[ "Calculate", "the", "sun", "earth", "distance", "correction", "relative", "to", "1", "AU", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/astronomy.py#L155-L171
pytroll/pyorbital
pyorbital/astronomy.py
observer_position
def observer_position(time, lon, lat, alt): """Calculate observer ECI position. http://celestrak.com/columns/v02n03/ """ lon = np.deg2rad(lon) lat = np.deg2rad(lat) theta = (gmst(time) + lon) % (2 * np.pi) c = 1 / np.sqrt(1 + F * (F - 2) * np.sin(lat)**2) sq = c * (1 - F)**2 achc...
python
def observer_position(time, lon, lat, alt): """Calculate observer ECI position. http://celestrak.com/columns/v02n03/ """ lon = np.deg2rad(lon) lat = np.deg2rad(lat) theta = (gmst(time) + lon) % (2 * np.pi) c = 1 / np.sqrt(1 + F * (F - 2) * np.sin(lat)**2) sq = c * (1 - F)**2 achc...
[ "def", "observer_position", "(", "time", ",", "lon", ",", "lat", ",", "alt", ")", ":", "lon", "=", "np", ".", "deg2rad", "(", "lon", ")", "lat", "=", "np", ".", "deg2rad", "(", "lat", ")", "theta", "=", "(", "gmst", "(", "time", ")", "+", "lon"...
Calculate observer ECI position. http://celestrak.com/columns/v02n03/
[ "Calculate", "observer", "ECI", "position", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/astronomy.py#L174-L196
pytroll/pyorbital
pyorbital/orbital.py
get_observer_look
def get_observer_look(sat_lon, sat_lat, sat_alt, utc_time, lon, lat, alt): """Calculate observers look angle to a satellite. http://celestrak.com/columns/v02n02/ utc_time: Observation time (datetime object) lon: Longitude of observer position on ground in degrees east lat: Latitude of observer posi...
python
def get_observer_look(sat_lon, sat_lat, sat_alt, utc_time, lon, lat, alt): """Calculate observers look angle to a satellite. http://celestrak.com/columns/v02n02/ utc_time: Observation time (datetime object) lon: Longitude of observer position on ground in degrees east lat: Latitude of observer posi...
[ "def", "get_observer_look", "(", "sat_lon", ",", "sat_lat", ",", "sat_alt", ",", "utc_time", ",", "lon", ",", "lat", ",", "alt", ")", ":", "(", "pos_x", ",", "pos_y", ",", "pos_z", ")", ",", "(", "vel_x", ",", "vel_y", ",", "vel_z", ")", "=", "astr...
Calculate observers look angle to a satellite. http://celestrak.com/columns/v02n02/ utc_time: Observation time (datetime object) lon: Longitude of observer position on ground in degrees east lat: Latitude of observer position on ground in degrees north alt: Altitude above sea-level (geoid) of obser...
[ "Calculate", "observers", "look", "angle", "to", "a", "satellite", ".", "http", ":", "//", "celestrak", ".", "com", "/", "columns", "/", "v02n02", "/" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/orbital.py#L90-L149
pytroll/pyorbital
pyorbital/orbital.py
Orbital.get_last_an_time
def get_last_an_time(self, utc_time): """Calculate time of last ascending node relative to the specified time """ # Propagate backwards to ascending node dt = np.timedelta64(10, 'm') t_old = utc_time t_new = t_old - dt pos0, vel0 = self.get_position(t_old...
python
def get_last_an_time(self, utc_time): """Calculate time of last ascending node relative to the specified time """ # Propagate backwards to ascending node dt = np.timedelta64(10, 'm') t_old = utc_time t_new = t_old - dt pos0, vel0 = self.get_position(t_old...
[ "def", "get_last_an_time", "(", "self", ",", "utc_time", ")", ":", "# Propagate backwards to ascending node", "dt", "=", "np", ".", "timedelta64", "(", "10", ",", "'m'", ")", "t_old", "=", "utc_time", "t_new", "=", "t_old", "-", "dt", "pos0", ",", "vel0", ...
Calculate time of last ascending node relative to the specified time
[ "Calculate", "time", "of", "last", "ascending", "node", "relative", "to", "the", "specified", "time" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/orbital.py#L172-L206
pytroll/pyorbital
pyorbital/orbital.py
Orbital.get_position
def get_position(self, utc_time, normalize=True): """Get the cartesian position and velocity from the satellite. """ kep = self._sgdp4.propagate(utc_time) pos, vel = kep2xyz(kep) if normalize: pos /= XKMPER vel /= XKMPER * XMNPDA / SECDAY return...
python
def get_position(self, utc_time, normalize=True): """Get the cartesian position and velocity from the satellite. """ kep = self._sgdp4.propagate(utc_time) pos, vel = kep2xyz(kep) if normalize: pos /= XKMPER vel /= XKMPER * XMNPDA / SECDAY return...
[ "def", "get_position", "(", "self", ",", "utc_time", ",", "normalize", "=", "True", ")", ":", "kep", "=", "self", ".", "_sgdp4", ".", "propagate", "(", "utc_time", ")", "pos", ",", "vel", "=", "kep2xyz", "(", "kep", ")", "if", "normalize", ":", "pos"...
Get the cartesian position and velocity from the satellite.
[ "Get", "the", "cartesian", "position", "and", "velocity", "from", "the", "satellite", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/orbital.py#L208-L219
pytroll/pyorbital
pyorbital/orbital.py
Orbital.get_lonlatalt
def get_lonlatalt(self, utc_time): """Calculate sublon, sublat and altitude of satellite. http://celestrak.com/columns/v02n03/ """ (pos_x, pos_y, pos_z), (vel_x, vel_y, vel_z) = self.get_position( utc_time, normalize=True) lon = ((np.arctan2(pos_y * XKMPER, pos_x * X...
python
def get_lonlatalt(self, utc_time): """Calculate sublon, sublat and altitude of satellite. http://celestrak.com/columns/v02n03/ """ (pos_x, pos_y, pos_z), (vel_x, vel_y, vel_z) = self.get_position( utc_time, normalize=True) lon = ((np.arctan2(pos_y * XKMPER, pos_x * X...
[ "def", "get_lonlatalt", "(", "self", ",", "utc_time", ")", ":", "(", "pos_x", ",", "pos_y", ",", "pos_z", ")", ",", "(", "vel_x", ",", "vel_y", ",", "vel_z", ")", "=", "self", ".", "get_position", "(", "utc_time", ",", "normalize", "=", "True", ")", ...
Calculate sublon, sublat and altitude of satellite. http://celestrak.com/columns/v02n03/
[ "Calculate", "sublon", "sublat", "and", "altitude", "of", "satellite", ".", "http", ":", "//", "celestrak", ".", "com", "/", "columns", "/", "v02n03", "/" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/orbital.py#L221-L245
pytroll/pyorbital
pyorbital/orbital.py
Orbital.get_observer_look
def get_observer_look(self, utc_time, lon, lat, alt): """Calculate observers look angle to a satellite. http://celestrak.com/columns/v02n02/ utc_time: Observation time (datetime object) lon: Longitude of observer position on ground in degrees east lat: Latitude of observer posit...
python
def get_observer_look(self, utc_time, lon, lat, alt): """Calculate observers look angle to a satellite. http://celestrak.com/columns/v02n02/ utc_time: Observation time (datetime object) lon: Longitude of observer position on ground in degrees east lat: Latitude of observer posit...
[ "def", "get_observer_look", "(", "self", ",", "utc_time", ",", "lon", ",", "lat", ",", "alt", ")", ":", "utc_time", "=", "dt2np", "(", "utc_time", ")", "(", "pos_x", ",", "pos_y", ",", "pos_z", ")", ",", "(", "vel_x", ",", "vel_y", ",", "vel_z", ")...
Calculate observers look angle to a satellite. http://celestrak.com/columns/v02n02/ utc_time: Observation time (datetime object) lon: Longitude of observer position on ground in degrees east lat: Latitude of observer position on ground in degrees north alt: Altitude above sea-le...
[ "Calculate", "observers", "look", "angle", "to", "a", "satellite", ".", "http", ":", "//", "celestrak", ".", "com", "/", "columns", "/", "v02n02", "/" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/orbital.py#L253-L299
pytroll/pyorbital
pyorbital/orbital.py
Orbital.get_orbit_number
def get_orbit_number(self, utc_time, tbus_style=False): """Calculate orbit number at specified time. Optionally use TBUS-style orbit numbering (TLE orbit number + 1) """ utc_time = np.datetime64(utc_time) try: dt = astronomy._days(utc_time - self.orbit_elements.an_tim...
python
def get_orbit_number(self, utc_time, tbus_style=False): """Calculate orbit number at specified time. Optionally use TBUS-style orbit numbering (TLE orbit number + 1) """ utc_time = np.datetime64(utc_time) try: dt = astronomy._days(utc_time - self.orbit_elements.an_tim...
[ "def", "get_orbit_number", "(", "self", ",", "utc_time", ",", "tbus_style", "=", "False", ")", ":", "utc_time", "=", "np", ".", "datetime64", "(", "utc_time", ")", "try", ":", "dt", "=", "astronomy", ".", "_days", "(", "utc_time", "-", "self", ".", "or...
Calculate orbit number at specified time. Optionally use TBUS-style orbit numbering (TLE orbit number + 1)
[ "Calculate", "orbit", "number", "at", "specified", "time", ".", "Optionally", "use", "TBUS", "-", "style", "orbit", "numbering", "(", "TLE", "orbit", "number", "+", "1", ")" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/orbital.py#L301-L333
pytroll/pyorbital
pyorbital/orbital.py
Orbital.get_next_passes
def get_next_passes(self, utc_time, length, lon, lat, alt, tol=0.001, horizon=0): """Calculate passes for the next hours for a given start time and a given observer. Original by Martin. utc_time: Observation time (datetime object) length: Number of hours to find passes (int) ...
python
def get_next_passes(self, utc_time, length, lon, lat, alt, tol=0.001, horizon=0): """Calculate passes for the next hours for a given start time and a given observer. Original by Martin. utc_time: Observation time (datetime object) length: Number of hours to find passes (int) ...
[ "def", "get_next_passes", "(", "self", ",", "utc_time", ",", "length", ",", "lon", ",", "lat", ",", "alt", ",", "tol", "=", "0.001", ",", "horizon", "=", "0", ")", ":", "def", "elevation", "(", "minutes", ")", ":", "\"\"\"Compute the elevation.\"\"\"", "...
Calculate passes for the next hours for a given start time and a given observer. Original by Martin. utc_time: Observation time (datetime object) length: Number of hours to find passes (int) lon: Longitude of observer position on ground (float) lat: Latitude of observer...
[ "Calculate", "passes", "for", "the", "next", "hours", "for", "a", "given", "start", "time", "and", "a", "given", "observer", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/orbital.py#L335-L431
pytroll/pyorbital
pyorbital/orbital.py
Orbital._get_time_at_horizon
def _get_time_at_horizon(self, utc_time, obslon, obslat, **kwargs): """Get the time closest in time to *utc_time* when the satellite is at the horizon relative to the position of an observer on ground (altitude = 0) Note: This is considered deprecated and it's functionality is currently...
python
def _get_time_at_horizon(self, utc_time, obslon, obslat, **kwargs): """Get the time closest in time to *utc_time* when the satellite is at the horizon relative to the position of an observer on ground (altitude = 0) Note: This is considered deprecated and it's functionality is currently...
[ "def", "_get_time_at_horizon", "(", "self", ",", "utc_time", ",", "obslon", ",", "obslat", ",", "*", "*", "kwargs", ")", ":", "warnings", ".", "warn", "(", "\"_get_time_at_horizon is replaced with get_next_passes\"", ",", "DeprecationWarning", ")", "if", "\"precisio...
Get the time closest in time to *utc_time* when the satellite is at the horizon relative to the position of an observer on ground (altitude = 0) Note: This is considered deprecated and it's functionality is currently replaced by 'get_next_passes'.
[ "Get", "the", "time", "closest", "in", "time", "to", "*", "utc_time", "*", "when", "the", "satellite", "is", "at", "the", "horizon", "relative", "to", "the", "position", "of", "an", "observer", "on", "ground", "(", "altitude", "=", "0", ")" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/orbital.py#L433-L485
pytroll/pyorbital
pyorbital/geoloc.py
subpoint
def subpoint(query_point, a=A, b=B): """Get the point on the ellipsoid under the *query_point*.""" x, y, z = query_point lat = geodetic_lat(query_point) lon = np.arctan2(y, x) e2_ = (a * a - b * b) / (a * a) n__ = a / np.sqrt(1 - e2_ * np.sin(lat)**2) nx_ = n__ * np.cos(lat) * np.cos(lon) ...
python
def subpoint(query_point, a=A, b=B): """Get the point on the ellipsoid under the *query_point*.""" x, y, z = query_point lat = geodetic_lat(query_point) lon = np.arctan2(y, x) e2_ = (a * a - b * b) / (a * a) n__ = a / np.sqrt(1 - e2_ * np.sin(lat)**2) nx_ = n__ * np.cos(lat) * np.cos(lon) ...
[ "def", "subpoint", "(", "query_point", ",", "a", "=", "A", ",", "b", "=", "B", ")", ":", "x", ",", "y", ",", "z", "=", "query_point", "lat", "=", "geodetic_lat", "(", "query_point", ")", "lon", "=", "np", ".", "arctan2", "(", "y", ",", "x", ")"...
Get the point on the ellipsoid under the *query_point*.
[ "Get", "the", "point", "on", "the", "ellipsoid", "under", "the", "*", "query_point", "*", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc.py#L61-L73
pytroll/pyorbital
pyorbital/geoloc.py
qrotate
def qrotate(vector, axis, angle): """Rotate *vector* around *axis* by *angle* (in radians). *vector* is a matrix of column vectors, as is *axis*. This function uses quaternion rotation. """ n_axis = axis / vnorm(axis) sin_angle = np.expand_dims(np.sin(angle / 2), 0) if np.ndim(n_axis) == 1:...
python
def qrotate(vector, axis, angle): """Rotate *vector* around *axis* by *angle* (in radians). *vector* is a matrix of column vectors, as is *axis*. This function uses quaternion rotation. """ n_axis = axis / vnorm(axis) sin_angle = np.expand_dims(np.sin(angle / 2), 0) if np.ndim(n_axis) == 1:...
[ "def", "qrotate", "(", "vector", ",", "axis", ",", "angle", ")", ":", "n_axis", "=", "axis", "/", "vnorm", "(", "axis", ")", "sin_angle", "=", "np", ".", "expand_dims", "(", "np", ".", "sin", "(", "angle", "/", "2", ")", ",", "0", ")", "if", "n...
Rotate *vector* around *axis* by *angle* (in radians). *vector* is a matrix of column vectors, as is *axis*. This function uses quaternion rotation.
[ "Rotate", "*", "vector", "*", "around", "*", "axis", "*", "by", "*", "angle", "*", "(", "in", "radians", ")", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc.py#L155-L173
pytroll/pyorbital
pyorbital/geoloc.py
compute_pixels
def compute_pixels(orb, sgeom, times, rpy=(0.0, 0.0, 0.0)): """Compute cartesian coordinates of the pixels in instrument scan.""" if isinstance(orb, (list, tuple)): tle1, tle2 = orb orb = Orbital("mysatellite", line1=tle1, line2=tle2) # get position and velocity for each time of each pixel ...
python
def compute_pixels(orb, sgeom, times, rpy=(0.0, 0.0, 0.0)): """Compute cartesian coordinates of the pixels in instrument scan.""" if isinstance(orb, (list, tuple)): tle1, tle2 = orb orb = Orbital("mysatellite", line1=tle1, line2=tle2) # get position and velocity for each time of each pixel ...
[ "def", "compute_pixels", "(", "orb", ",", "sgeom", ",", "times", ",", "rpy", "=", "(", "0.0", ",", "0.0", ",", "0.0", ")", ")", ":", "if", "isinstance", "(", "orb", ",", "(", "list", ",", "tuple", ")", ")", ":", "tle1", ",", "tle2", "=", "orb",...
Compute cartesian coordinates of the pixels in instrument scan.
[ "Compute", "cartesian", "coordinates", "of", "the", "pixels", "in", "instrument", "scan", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc.py#L204-L238
pytroll/pyorbital
pyorbital/geoloc.py
mnorm
def mnorm(m, axis=None): """norm of a matrix of vectors stacked along the *axis* dimension.""" if axis is None: axis = np.ndim(m) - 1 return np.sqrt((m**2).sum(axis))
python
def mnorm(m, axis=None): """norm of a matrix of vectors stacked along the *axis* dimension.""" if axis is None: axis = np.ndim(m) - 1 return np.sqrt((m**2).sum(axis))
[ "def", "mnorm", "(", "m", ",", "axis", "=", "None", ")", ":", "if", "axis", "is", "None", ":", "axis", "=", "np", ".", "ndim", "(", "m", ")", "-", "1", "return", "np", ".", "sqrt", "(", "(", "m", "**", "2", ")", ".", "sum", "(", "axis", "...
norm of a matrix of vectors stacked along the *axis* dimension.
[ "norm", "of", "a", "matrix", "of", "vectors", "stacked", "along", "the", "*", "axis", "*", "dimension", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc.py#L245-L249
pytroll/pyorbital
pyorbital/geoloc.py
ScanGeometry.vectors
def vectors(self, pos, vel, roll=0.0, pitch=0.0, yaw=0.0): """Get unit vectors pointing to the different pixels. *pos* and *vel* are column vectors, or matrices of column vectors. Returns vectors as stacked rows. """ # TODO: yaw steering mode ! # Fake nadir: This is the...
python
def vectors(self, pos, vel, roll=0.0, pitch=0.0, yaw=0.0): """Get unit vectors pointing to the different pixels. *pos* and *vel* are column vectors, or matrices of column vectors. Returns vectors as stacked rows. """ # TODO: yaw steering mode ! # Fake nadir: This is the...
[ "def", "vectors", "(", "self", ",", "pos", ",", "vel", ",", "roll", "=", "0.0", ",", "pitch", "=", "0.0", ",", "yaw", "=", "0.0", ")", ":", "# TODO: yaw steering mode !", "# Fake nadir: This is the intersection point between the satellite", "# looking down at the cent...
Get unit vectors pointing to the different pixels. *pos* and *vel* are column vectors, or matrices of column vectors. Returns vectors as stacked rows.
[ "Get", "unit", "vectors", "pointing", "to", "the", "different", "pixels", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc.py#L90-L119
pytroll/pyorbital
pyorbital/geoloc_instrument_definitions.py
avhrr
def avhrr(scans_nb, scan_points, scan_angle=55.37, frequency=1 / 6.0, apply_offset=True): """Definition of the avhrr instrument. Source: NOAA KLM User's Guide, Appendix J http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/j/app-j.htm """ # build the avhrr instrument (scan angles) ...
python
def avhrr(scans_nb, scan_points, scan_angle=55.37, frequency=1 / 6.0, apply_offset=True): """Definition of the avhrr instrument. Source: NOAA KLM User's Guide, Appendix J http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/j/app-j.htm """ # build the avhrr instrument (scan angles) ...
[ "def", "avhrr", "(", "scans_nb", ",", "scan_points", ",", "scan_angle", "=", "55.37", ",", "frequency", "=", "1", "/", "6.0", ",", "apply_offset", "=", "True", ")", ":", "# build the avhrr instrument (scan angles)", "avhrr_inst", "=", "np", ".", "vstack", "(",...
Definition of the avhrr instrument. Source: NOAA KLM User's Guide, Appendix J http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/j/app-j.htm
[ "Definition", "of", "the", "avhrr", "instrument", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc_instrument_definitions.py#L52-L76
pytroll/pyorbital
pyorbital/geoloc_instrument_definitions.py
avhrr_gac
def avhrr_gac(scan_times, scan_points, scan_angle=55.37, frequency=0.5): """Definition of the avhrr instrument, gac version Source: NOAA KLM User's Guide, Appendix J http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/j/app-j.htm """ try: offset = np.array([(t - scan_time...
python
def avhrr_gac(scan_times, scan_points, scan_angle=55.37, frequency=0.5): """Definition of the avhrr instrument, gac version Source: NOAA KLM User's Guide, Appendix J http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/j/app-j.htm """ try: offset = np.array([(t - scan_time...
[ "def", "avhrr_gac", "(", "scan_times", ",", "scan_points", ",", "scan_angle", "=", "55.37", ",", "frequency", "=", "0.5", ")", ":", "try", ":", "offset", "=", "np", ".", "array", "(", "[", "(", "t", "-", "scan_times", "[", "0", "]", ")", ".", "seco...
Definition of the avhrr instrument, gac version Source: NOAA KLM User's Guide, Appendix J http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/j/app-j.htm
[ "Definition", "of", "the", "avhrr", "instrument", "gac", "version" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc_instrument_definitions.py#L79-L102
pytroll/pyorbital
pyorbital/geoloc_instrument_definitions.py
viirs
def viirs(scans_nb, scan_indices=slice(0, None), chn_pixels=6400, scan_lines=32, scan_step=1): """Describe VIIRS instrument geometry, I-band by default. VIIRS scans several lines simultaneously (there are 16 detectors for each M-band, 32 detectors for each I-band) so the scan angles (and times) ar...
python
def viirs(scans_nb, scan_indices=slice(0, None), chn_pixels=6400, scan_lines=32, scan_step=1): """Describe VIIRS instrument geometry, I-band by default. VIIRS scans several lines simultaneously (there are 16 detectors for each M-band, 32 detectors for each I-band) so the scan angles (and times) ar...
[ "def", "viirs", "(", "scans_nb", ",", "scan_indices", "=", "slice", "(", "0", ",", "None", ")", ",", "chn_pixels", "=", "6400", ",", "scan_lines", "=", "32", ",", "scan_step", "=", "1", ")", ":", "entire_width", "=", "np", ".", "arange", "(", "chn_pi...
Describe VIIRS instrument geometry, I-band by default. VIIRS scans several lines simultaneously (there are 16 detectors for each M-band, 32 detectors for each I-band) so the scan angles (and times) are two-dimensional arrays, contrary to AVHRR for example. scan_step: The increment in number of scans. E...
[ "Describe", "VIIRS", "instrument", "geometry", "I", "-", "band", "by", "default", ".", "VIIRS", "scans", "several", "lines", "simultaneously", "(", "there", "are", "16", "detectors", "for", "each", "M", "-", "band", "32", "detectors", "for", "each", "I", "...
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc_instrument_definitions.py#L144-L197
pytroll/pyorbital
pyorbital/geoloc_instrument_definitions.py
hirs4
def hirs4(scans_nb, edges_only=False): """Describe HIRS/4 instrument geometry. See: - https://www.eumetsat.int/website/home/Satellites/CurrentSatellites/Metop/MetopDesign/HIRS/index.html - https://www1.ncdc.noaa.gov/pub/data/satellite/publications/podguides/ N-15%20thru%20N-19/pdf/0.0%20NOAA%...
python
def hirs4(scans_nb, edges_only=False): """Describe HIRS/4 instrument geometry. See: - https://www.eumetsat.int/website/home/Satellites/CurrentSatellites/Metop/MetopDesign/HIRS/index.html - https://www1.ncdc.noaa.gov/pub/data/satellite/publications/podguides/ N-15%20thru%20N-19/pdf/0.0%20NOAA%...
[ "def", "hirs4", "(", "scans_nb", ",", "edges_only", "=", "False", ")", ":", "scan_len", "=", "56", "# 56 samples per scan", "scan_rate", "=", "6.4", "# single scan, seconds", "scan_angle", "=", "-", "49.5", "# swath, degrees", "sampling_interval", "=", "abs", "(",...
Describe HIRS/4 instrument geometry. See: - https://www.eumetsat.int/website/home/Satellites/CurrentSatellites/Metop/MetopDesign/HIRS/index.html - https://www1.ncdc.noaa.gov/pub/data/satellite/publications/podguides/ N-15%20thru%20N-19/pdf/0.0%20NOAA%20KLM%20Users%20Guide.pdf (NOAA KLM User...
[ "Describe", "HIRS", "/", "4", "instrument", "geometry", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc_instrument_definitions.py#L321-L363
pytroll/pyorbital
pyorbital/geoloc_instrument_definitions.py
olci
def olci(scans_nb, scan_points=None): """Definition of the OLCI instrument. Source: Sentinel-3 OLCI Coverage https://sentinel.esa.int/web/sentinel/user-guides/sentinel-3-olci/coverage """ if scan_points is None: scan_len = 4000 # samples per scan scan_points = np.arange(4000) ...
python
def olci(scans_nb, scan_points=None): """Definition of the OLCI instrument. Source: Sentinel-3 OLCI Coverage https://sentinel.esa.int/web/sentinel/user-guides/sentinel-3-olci/coverage """ if scan_points is None: scan_len = 4000 # samples per scan scan_points = np.arange(4000) ...
[ "def", "olci", "(", "scans_nb", ",", "scan_points", "=", "None", ")", ":", "if", "scan_points", "is", "None", ":", "scan_len", "=", "4000", "# samples per scan", "scan_points", "=", "np", ".", "arange", "(", "4000", ")", "else", ":", "scan_len", "=", "le...
Definition of the OLCI instrument. Source: Sentinel-3 OLCI Coverage https://sentinel.esa.int/web/sentinel/user-guides/sentinel-3-olci/coverage
[ "Definition", "of", "the", "OLCI", "instrument", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc_instrument_definitions.py#L434-L466
pytroll/pyorbital
pyorbital/geoloc_instrument_definitions.py
ascat
def ascat(scan_nb, scan_points=None): """ASCAT make two scans one to the left and one to the right of the sub-satellite track. """ if scan_points is None: scan_len = 42 # samples per scan scan_points = np.arange(42) else: scan_len = len(scan_points) scan_angle_inner =...
python
def ascat(scan_nb, scan_points=None): """ASCAT make two scans one to the left and one to the right of the sub-satellite track. """ if scan_points is None: scan_len = 42 # samples per scan scan_points = np.arange(42) else: scan_len = len(scan_points) scan_angle_inner =...
[ "def", "ascat", "(", "scan_nb", ",", "scan_points", "=", "None", ")", ":", "if", "scan_points", "is", "None", ":", "scan_len", "=", "42", "# samples per scan", "scan_points", "=", "np", ".", "arange", "(", "42", ")", "else", ":", "scan_len", "=", "len", ...
ASCAT make two scans one to the left and one to the right of the sub-satellite track.
[ "ASCAT", "make", "two", "scans", "one", "to", "the", "left", "and", "one", "to", "the", "right", "of", "the", "sub", "-", "satellite", "track", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/geoloc_instrument_definitions.py#L469-L507
pytroll/pyorbital
pyorbital/tlefile.py
read_platform_numbers
def read_platform_numbers(in_upper=False, num_as_int=False): """Read platform numbers from $PPP_CONFIG_DIR/platforms.txt if available.""" out_dict = {} os.getenv('PPP_CONFIG_DIR', PKG_CONFIG_DIR) platform_file = None if 'PPP_CONFIG_DIR' in os.environ: platform_file = os.path.join(os.environ[...
python
def read_platform_numbers(in_upper=False, num_as_int=False): """Read platform numbers from $PPP_CONFIG_DIR/platforms.txt if available.""" out_dict = {} os.getenv('PPP_CONFIG_DIR', PKG_CONFIG_DIR) platform_file = None if 'PPP_CONFIG_DIR' in os.environ: platform_file = os.path.join(os.environ[...
[ "def", "read_platform_numbers", "(", "in_upper", "=", "False", ",", "num_as_int", "=", "False", ")", ":", "out_dict", "=", "{", "}", "os", ".", "getenv", "(", "'PPP_CONFIG_DIR'", ",", "PKG_CONFIG_DIR", ")", "platform_file", "=", "None", "if", "'PPP_CONFIG_DIR'...
Read platform numbers from $PPP_CONFIG_DIR/platforms.txt if available.
[ "Read", "platform", "numbers", "from", "$PPP_CONFIG_DIR", "/", "platforms", ".", "txt", "if", "available", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/tlefile.py#L49-L77
pytroll/pyorbital
pyorbital/tlefile.py
read
def read(platform, tle_file=None, line1=None, line2=None): """Read TLE for `platform` from `tle_file` File is read from `line1` to `line2`, from the newest file provided in the TLES pattern, or from internet if none is provided. """ return Tle(platform, tle_file=tle_file, line1=line1, line2=line2)
python
def read(platform, tle_file=None, line1=None, line2=None): """Read TLE for `platform` from `tle_file` File is read from `line1` to `line2`, from the newest file provided in the TLES pattern, or from internet if none is provided. """ return Tle(platform, tle_file=tle_file, line1=line1, line2=line2)
[ "def", "read", "(", "platform", ",", "tle_file", "=", "None", ",", "line1", "=", "None", ",", "line2", "=", "None", ")", ":", "return", "Tle", "(", "platform", ",", "tle_file", "=", "tle_file", ",", "line1", "=", "line1", ",", "line2", "=", "line2", ...
Read TLE for `platform` from `tle_file` File is read from `line1` to `line2`, from the newest file provided in the TLES pattern, or from internet if none is provided.
[ "Read", "TLE", "for", "platform", "from", "tle_file" ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/tlefile.py#L91-L97
pytroll/pyorbital
pyorbital/tlefile.py
fetch
def fetch(destination): """Fetch TLE from internet and save it to `destination`.""" with io.open(destination, mode="w", encoding="utf-8") as dest: for url in TLE_URLS: response = urlopen(url) dest.write(response.read().decode("utf-8"))
python
def fetch(destination): """Fetch TLE from internet and save it to `destination`.""" with io.open(destination, mode="w", encoding="utf-8") as dest: for url in TLE_URLS: response = urlopen(url) dest.write(response.read().decode("utf-8"))
[ "def", "fetch", "(", "destination", ")", ":", "with", "io", ".", "open", "(", "destination", ",", "mode", "=", "\"w\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "dest", ":", "for", "url", "in", "TLE_URLS", ":", "response", "=", "urlopen", "(", "...
Fetch TLE from internet and save it to `destination`.
[ "Fetch", "TLE", "from", "internet", "and", "save", "it", "to", "destination", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/tlefile.py#L100-L105
pytroll/pyorbital
pyorbital/tlefile.py
Tle._checksum
def _checksum(self): """Performs the checksum for the current TLE.""" for line in [self._line1, self._line2]: check = 0 for char in line[:-1]: if char.isdigit(): check += int(char) if char == "-": check += 1 ...
python
def _checksum(self): """Performs the checksum for the current TLE.""" for line in [self._line1, self._line2]: check = 0 for char in line[:-1]: if char.isdigit(): check += int(char) if char == "-": check += 1 ...
[ "def", "_checksum", "(", "self", ")", ":", "for", "line", "in", "[", "self", ".", "_line1", ",", "self", ".", "_line2", "]", ":", "check", "=", "0", "for", "char", "in", "line", "[", ":", "-", "1", "]", ":", "if", "char", ".", "isdigit", "(", ...
Performs the checksum for the current TLE.
[ "Performs", "the", "checksum", "for", "the", "current", "TLE", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/tlefile.py#L162-L173
pytroll/pyorbital
pyorbital/tlefile.py
Tle._read_tle
def _read_tle(self): """Read TLE data.""" if self._line1 is not None and self._line2 is not None: tle = self._line1.strip() + "\n" + self._line2.strip() else: def _open(filename): return io.open(filename, 'rb') if self._tle_file: ...
python
def _read_tle(self): """Read TLE data.""" if self._line1 is not None and self._line2 is not None: tle = self._line1.strip() + "\n" + self._line2.strip() else: def _open(filename): return io.open(filename, 'rb') if self._tle_file: ...
[ "def", "_read_tle", "(", "self", ")", ":", "if", "self", ".", "_line1", "is", "not", "None", "and", "self", ".", "_line2", "is", "not", "None", ":", "tle", "=", "self", ".", "_line1", ".", "strip", "(", ")", "+", "\"\\n\"", "+", "self", ".", "_li...
Read TLE data.
[ "Read", "TLE", "data", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/tlefile.py#L175-L225
pytroll/pyorbital
pyorbital/tlefile.py
Tle._parse_tle
def _parse_tle(self): """Parse values from TLE data.""" def _read_tle_decimal(rep): """Convert *rep* to decimal value.""" if rep[0] in ["-", " ", "+"]: digits = rep[1:-2].strip() val = rep[0] + "." + digits + "e" + rep[-2:] else: ...
python
def _parse_tle(self): """Parse values from TLE data.""" def _read_tle_decimal(rep): """Convert *rep* to decimal value.""" if rep[0] in ["-", " ", "+"]: digits = rep[1:-2].strip() val = rep[0] + "." + digits + "e" + rep[-2:] else: ...
[ "def", "_parse_tle", "(", "self", ")", ":", "def", "_read_tle_decimal", "(", "rep", ")", ":", "\"\"\"Convert *rep* to decimal value.\"\"\"", "if", "rep", "[", "0", "]", "in", "[", "\"-\"", ",", "\" \"", ",", "\"+\"", "]", ":", "digits", "=", "rep", "[", ...
Parse values from TLE data.
[ "Parse", "values", "from", "TLE", "data", "." ]
train
https://github.com/pytroll/pyorbital/blob/647007934dc827a4c698629cf32a84a5167844b2/pyorbital/tlefile.py#L227-L266
lorien/user_agent
user_agent/base.py
fix_chrome_mac_platform
def fix_chrome_mac_platform(platform): """ Chrome on Mac OS adds minor version number and uses underscores instead of dots. E.g. platform for Firefox will be: 'Intel Mac OS X 10.11' but for Chrome it will be 'Intel Mac OS X 10_11_6'. :param platform: - string like "Macintosh; Intel Mac OS X 10.8" ...
python
def fix_chrome_mac_platform(platform): """ Chrome on Mac OS adds minor version number and uses underscores instead of dots. E.g. platform for Firefox will be: 'Intel Mac OS X 10.11' but for Chrome it will be 'Intel Mac OS X 10_11_6'. :param platform: - string like "Macintosh; Intel Mac OS X 10.8" ...
[ "def", "fix_chrome_mac_platform", "(", "platform", ")", ":", "ver", "=", "platform", ".", "split", "(", "'OS X '", ")", "[", "1", "]", "build_range", "=", "range", "(", "*", "MACOSX_CHROME_BUILD_RANGE", "[", "ver", "]", ")", "build", "=", "choice", "(", ...
Chrome on Mac OS adds minor version number and uses underscores instead of dots. E.g. platform for Firefox will be: 'Intel Mac OS X 10.11' but for Chrome it will be 'Intel Mac OS X 10_11_6'. :param platform: - string like "Macintosh; Intel Mac OS X 10.8" :return: platform with version number including ...
[ "Chrome", "on", "Mac", "OS", "adds", "minor", "version", "number", "and", "uses", "underscores", "instead", "of", "dots", ".", "E", ".", "g", ".", "platform", "for", "Firefox", "will", "be", ":", "Intel", "Mac", "OS", "X", "10", ".", "11", "but", "fo...
train
https://github.com/lorien/user_agent/blob/f37f45d9cf914dd1e535b272ba120626d1f5682d/user_agent/base.py#L249-L263
lorien/user_agent
user_agent/base.py
build_system_components
def build_system_components(device_type, os_id, navigator_id): """ For given os_id build random platform and oscpu components Returns dict {platform_version, platform, ua_platform, oscpu} platform_version is OS name used in different places ua_platform goes to navigator.platform platform i...
python
def build_system_components(device_type, os_id, navigator_id): """ For given os_id build random platform and oscpu components Returns dict {platform_version, platform, ua_platform, oscpu} platform_version is OS name used in different places ua_platform goes to navigator.platform platform i...
[ "def", "build_system_components", "(", "device_type", ",", "os_id", ",", "navigator_id", ")", ":", "if", "os_id", "==", "'win'", ":", "platform_version", "=", "choice", "(", "OS_PLATFORM", "[", "'win'", "]", ")", "cpu", "=", "choice", "(", "OS_CPU", "[", "...
For given os_id build random platform and oscpu components Returns dict {platform_version, platform, ua_platform, oscpu} platform_version is OS name used in different places ua_platform goes to navigator.platform platform is used in building navigator.userAgent oscpu goes to navigator.oscpu
[ "For", "given", "os_id", "build", "random", "platform", "and", "oscpu", "components" ]
train
https://github.com/lorien/user_agent/blob/f37f45d9cf914dd1e535b272ba120626d1f5682d/user_agent/base.py#L266-L333
lorien/user_agent
user_agent/base.py
build_app_components
def build_app_components(os_id, navigator_id): """ For given navigator_id build app features Returns dict {name, product_sub, vendor, build_version, build_id} """ if navigator_id == 'firefox': build_version, build_id = get_firefox_build() if os_id in ('win', 'linux', 'mac'): ...
python
def build_app_components(os_id, navigator_id): """ For given navigator_id build app features Returns dict {name, product_sub, vendor, build_version, build_id} """ if navigator_id == 'firefox': build_version, build_id = get_firefox_build() if os_id in ('win', 'linux', 'mac'): ...
[ "def", "build_app_components", "(", "os_id", ",", "navigator_id", ")", ":", "if", "navigator_id", "==", "'firefox'", ":", "build_version", ",", "build_id", "=", "get_firefox_build", "(", ")", "if", "os_id", "in", "(", "'win'", ",", "'linux'", ",", "'mac'", "...
For given navigator_id build app features Returns dict {name, product_sub, vendor, build_version, build_id}
[ "For", "given", "navigator_id", "build", "app", "features" ]
train
https://github.com/lorien/user_agent/blob/f37f45d9cf914dd1e535b272ba120626d1f5682d/user_agent/base.py#L336-L379
lorien/user_agent
user_agent/base.py
get_option_choices
def get_option_choices(opt_name, opt_value, default_value, all_choices): """ Generate possible choices for the option `opt_name` limited to `opt_value` value with default value as `default_value` """ choices = [] if isinstance(opt_value, six.string_types): choices = [opt_value] ...
python
def get_option_choices(opt_name, opt_value, default_value, all_choices): """ Generate possible choices for the option `opt_name` limited to `opt_value` value with default value as `default_value` """ choices = [] if isinstance(opt_value, six.string_types): choices = [opt_value] ...
[ "def", "get_option_choices", "(", "opt_name", ",", "opt_value", ",", "default_value", ",", "all_choices", ")", ":", "choices", "=", "[", "]", "if", "isinstance", "(", "opt_value", ",", "six", ".", "string_types", ")", ":", "choices", "=", "[", "opt_value", ...
Generate possible choices for the option `opt_name` limited to `opt_value` value with default value as `default_value`
[ "Generate", "possible", "choices", "for", "the", "option", "opt_name", "limited", "to", "opt_value", "value", "with", "default", "value", "as", "default_value" ]
train
https://github.com/lorien/user_agent/blob/f37f45d9cf914dd1e535b272ba120626d1f5682d/user_agent/base.py#L382-L405
lorien/user_agent
user_agent/base.py
pick_config_ids
def pick_config_ids(device_type, os, navigator): """ Select one random pair (device_type, os_id, navigator_id) from all possible combinations matching the given os and navigator filters. :param os: allowed os(es) :type os: string or list/tuple or None :param navigator: allowed browser engin...
python
def pick_config_ids(device_type, os, navigator): """ Select one random pair (device_type, os_id, navigator_id) from all possible combinations matching the given os and navigator filters. :param os: allowed os(es) :type os: string or list/tuple or None :param navigator: allowed browser engin...
[ "def", "pick_config_ids", "(", "device_type", ",", "os", ",", "navigator", ")", ":", "if", "os", "is", "None", ":", "default_dev_types", "=", "[", "'desktop'", "]", "else", ":", "default_dev_types", "=", "list", "(", "DEVICE_TYPE_OS", ".", "keys", "(", ")"...
Select one random pair (device_type, os_id, navigator_id) from all possible combinations matching the given os and navigator filters. :param os: allowed os(es) :type os: string or list/tuple or None :param navigator: allowed browser engine(s) :type navigator: string or list/tuple or None :p...
[ "Select", "one", "random", "pair", "(", "device_type", "os_id", "navigator_id", ")", "from", "all", "possible", "combinations", "matching", "the", "given", "os", "and", "navigator", "filters", "." ]
train
https://github.com/lorien/user_agent/blob/f37f45d9cf914dd1e535b272ba120626d1f5682d/user_agent/base.py#L408-L455
lorien/user_agent
user_agent/base.py
generate_navigator
def generate_navigator(os=None, navigator=None, platform=None, device_type=None): """ Generates web navigator's config :param os: limit list of oses for generation :type os: string or list/tuple or None :param navigator: limit list of browser engines for generation :type ...
python
def generate_navigator(os=None, navigator=None, platform=None, device_type=None): """ Generates web navigator's config :param os: limit list of oses for generation :type os: string or list/tuple or None :param navigator: limit list of browser engines for generation :type ...
[ "def", "generate_navigator", "(", "os", "=", "None", ",", "navigator", "=", "None", ",", "platform", "=", "None", ",", "device_type", "=", "None", ")", ":", "if", "platform", "is", "not", "None", ":", "os", "=", "platform", "warn", "(", "'The `platform` ...
Generates web navigator's config :param os: limit list of oses for generation :type os: string or list/tuple or None :param navigator: limit list of browser engines for generation :type navigator: string or list/tuple or None :param device_type: limit possible oses by device type :type device_t...
[ "Generates", "web", "navigator", "s", "config" ]
train
https://github.com/lorien/user_agent/blob/f37f45d9cf914dd1e535b272ba120626d1f5682d/user_agent/base.py#L489-L546
lorien/user_agent
user_agent/base.py
generate_user_agent
def generate_user_agent(os=None, navigator=None, platform=None, device_type=None): """ Generates HTTP User-Agent header :param os: limit list of os for generation :type os: string or list/tuple or None :param navigator: limit list of browser engines for generation :type ...
python
def generate_user_agent(os=None, navigator=None, platform=None, device_type=None): """ Generates HTTP User-Agent header :param os: limit list of os for generation :type os: string or list/tuple or None :param navigator: limit list of browser engines for generation :type ...
[ "def", "generate_user_agent", "(", "os", "=", "None", ",", "navigator", "=", "None", ",", "platform", "=", "None", ",", "device_type", "=", "None", ")", ":", "return", "generate_navigator", "(", "os", "=", "os", ",", "navigator", "=", "navigator", ",", "...
Generates HTTP User-Agent header :param os: limit list of os for generation :type os: string or list/tuple or None :param navigator: limit list of browser engines for generation :type navigator: string or list/tuple or None :param device_type: limit possible oses by device type :type device_typ...
[ "Generates", "HTTP", "User", "-", "Agent", "header" ]
train
https://github.com/lorien/user_agent/blob/f37f45d9cf914dd1e535b272ba120626d1f5682d/user_agent/base.py#L549-L569
lorien/user_agent
user_agent/base.py
generate_navigator_js
def generate_navigator_js(os=None, navigator=None, platform=None, device_type=None): """ Generates web navigator's config with keys corresponding to keys of `windows.navigator` JavaScript object. :param os: limit list of oses for generation :type os: string or list/tuple o...
python
def generate_navigator_js(os=None, navigator=None, platform=None, device_type=None): """ Generates web navigator's config with keys corresponding to keys of `windows.navigator` JavaScript object. :param os: limit list of oses for generation :type os: string or list/tuple o...
[ "def", "generate_navigator_js", "(", "os", "=", "None", ",", "navigator", "=", "None", ",", "platform", "=", "None", ",", "device_type", "=", "None", ")", ":", "config", "=", "generate_navigator", "(", "os", "=", "os", ",", "navigator", "=", "navigator", ...
Generates web navigator's config with keys corresponding to keys of `windows.navigator` JavaScript object. :param os: limit list of oses for generation :type os: string or list/tuple or None :param navigator: limit list of browser engines for generation :type navigator: string or list/tuple or None...
[ "Generates", "web", "navigator", "s", "config", "with", "keys", "corresponding", "to", "keys", "of", "windows", ".", "navigator", "JavaScript", "object", "." ]
train
https://github.com/lorien/user_agent/blob/f37f45d9cf914dd1e535b272ba120626d1f5682d/user_agent/base.py#L572-L607
thiezn/iperf3-python
iperf3/iperf3.py
more_data
def more_data(pipe_out): """Check if there is more data left on the pipe :param pipe_out: The os pipe_out :rtype: bool """ r, _, _ = select.select([pipe_out], [], [], 0) return bool(r)
python
def more_data(pipe_out): """Check if there is more data left on the pipe :param pipe_out: The os pipe_out :rtype: bool """ r, _, _ = select.select([pipe_out], [], [], 0) return bool(r)
[ "def", "more_data", "(", "pipe_out", ")", ":", "r", ",", "_", ",", "_", "=", "select", ".", "select", "(", "[", "pipe_out", "]", ",", "[", "]", ",", "[", "]", ",", "0", ")", "return", "bool", "(", "r", ")" ]
Check if there is more data left on the pipe :param pipe_out: The os pipe_out :rtype: bool
[ "Check", "if", "there", "is", "more", "data", "left", "on", "the", "pipe" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L40-L47
thiezn/iperf3-python
iperf3/iperf3.py
read_pipe
def read_pipe(pipe_out): """Read data on a pipe Used to capture stdout data produced by libiperf :param pipe_out: The os pipe_out :rtype: unicode string """ out = b'' while more_data(pipe_out): out += os.read(pipe_out, 1024) return out.decode('utf-8')
python
def read_pipe(pipe_out): """Read data on a pipe Used to capture stdout data produced by libiperf :param pipe_out: The os pipe_out :rtype: unicode string """ out = b'' while more_data(pipe_out): out += os.read(pipe_out, 1024) return out.decode('utf-8')
[ "def", "read_pipe", "(", "pipe_out", ")", ":", "out", "=", "b''", "while", "more_data", "(", "pipe_out", ")", ":", "out", "+=", "os", ".", "read", "(", "pipe_out", ",", "1024", ")", "return", "out", ".", "decode", "(", "'utf-8'", ")" ]
Read data on a pipe Used to capture stdout data produced by libiperf :param pipe_out: The os pipe_out :rtype: unicode string
[ "Read", "data", "on", "a", "pipe" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L50-L62
thiezn/iperf3-python
iperf3/iperf3.py
IPerf3.role
def role(self): """The iperf3 instance role valid roles are 'c'=client and 's'=server :rtype: 'c' or 's' """ try: self._role = c_char( self.lib.iperf_get_test_role(self._test) ).value.decode('utf-8') except TypeError: ...
python
def role(self): """The iperf3 instance role valid roles are 'c'=client and 's'=server :rtype: 'c' or 's' """ try: self._role = c_char( self.lib.iperf_get_test_role(self._test) ).value.decode('utf-8') except TypeError: ...
[ "def", "role", "(", "self", ")", ":", "try", ":", "self", ".", "_role", "=", "c_char", "(", "self", ".", "lib", ".", "iperf_get_test_role", "(", "self", ".", "_test", ")", ")", ".", "value", ".", "decode", "(", "'utf-8'", ")", "except", "TypeError", ...
The iperf3 instance role valid roles are 'c'=client and 's'=server :rtype: 'c' or 's'
[ "The", "iperf3", "instance", "role" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L246-L261
thiezn/iperf3-python
iperf3/iperf3.py
IPerf3.bind_address
def bind_address(self): """The bind address the iperf3 instance will listen on use * to listen on all available IPs :rtype: string """ result = c_char_p( self.lib.iperf_get_test_bind_address(self._test) ).value if result: self._bind_addres...
python
def bind_address(self): """The bind address the iperf3 instance will listen on use * to listen on all available IPs :rtype: string """ result = c_char_p( self.lib.iperf_get_test_bind_address(self._test) ).value if result: self._bind_addres...
[ "def", "bind_address", "(", "self", ")", ":", "result", "=", "c_char_p", "(", "self", ".", "lib", ".", "iperf_get_test_bind_address", "(", "self", ".", "_test", ")", ")", ".", "value", "if", "result", ":", "self", ".", "_bind_address", "=", "result", "."...
The bind address the iperf3 instance will listen on use * to listen on all available IPs :rtype: string
[ "The", "bind", "address", "the", "iperf3", "instance", "will", "listen", "on" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L275-L289
thiezn/iperf3-python
iperf3/iperf3.py
IPerf3.port
def port(self): """The port the iperf3 server is listening on""" self._port = self.lib.iperf_get_test_server_port(self._test) return self._port
python
def port(self): """The port the iperf3 server is listening on""" self._port = self.lib.iperf_get_test_server_port(self._test) return self._port
[ "def", "port", "(", "self", ")", ":", "self", ".", "_port", "=", "self", ".", "lib", ".", "iperf_get_test_server_port", "(", "self", ".", "_test", ")", "return", "self", ".", "_port" ]
The port the iperf3 server is listening on
[ "The", "port", "the", "iperf3", "server", "is", "listening", "on" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L300-L303
thiezn/iperf3-python
iperf3/iperf3.py
IPerf3.json_output
def json_output(self): """Toggles json output of libiperf Turning this off will output the iperf3 instance results to stdout/stderr :rtype: bool """ enabled = self.lib.iperf_get_test_json_output(self._test) if enabled: self._json_output = True ...
python
def json_output(self): """Toggles json output of libiperf Turning this off will output the iperf3 instance results to stdout/stderr :rtype: bool """ enabled = self.lib.iperf_get_test_json_output(self._test) if enabled: self._json_output = True ...
[ "def", "json_output", "(", "self", ")", ":", "enabled", "=", "self", ".", "lib", ".", "iperf_get_test_json_output", "(", "self", ".", "_test", ")", "if", "enabled", ":", "self", ".", "_json_output", "=", "True", "else", ":", "self", ".", "_json_output", ...
Toggles json output of libiperf Turning this off will output the iperf3 instance results to stdout/stderr :rtype: bool
[ "Toggles", "json", "output", "of", "libiperf" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L311-L326
thiezn/iperf3-python
iperf3/iperf3.py
IPerf3.verbose
def verbose(self): """Toggles verbose output for the iperf3 instance :rtype: bool """ enabled = self.lib.iperf_get_verbose(self._test) if enabled: self._verbose = True else: self._verbose = False return self._verbose
python
def verbose(self): """Toggles verbose output for the iperf3 instance :rtype: bool """ enabled = self.lib.iperf_get_verbose(self._test) if enabled: self._verbose = True else: self._verbose = False return self._verbose
[ "def", "verbose", "(", "self", ")", ":", "enabled", "=", "self", ".", "lib", ".", "iperf_get_verbose", "(", "self", ".", "_test", ")", "if", "enabled", ":", "self", ".", "_verbose", "=", "True", "else", ":", "self", ".", "_verbose", "=", "False", "re...
Toggles verbose output for the iperf3 instance :rtype: bool
[ "Toggles", "verbose", "output", "for", "the", "iperf3", "instance" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L338-L350
thiezn/iperf3-python
iperf3/iperf3.py
IPerf3.iperf_version
def iperf_version(self): """Returns the version of the libiperf library :rtype: string """ # TODO: Is there a better way to get the const char than allocating 30? VersionType = c_char * 30 return VersionType.in_dll(self.lib, "version").value.decode('utf-8')
python
def iperf_version(self): """Returns the version of the libiperf library :rtype: string """ # TODO: Is there a better way to get the const char than allocating 30? VersionType = c_char * 30 return VersionType.in_dll(self.lib, "version").value.decode('utf-8')
[ "def", "iperf_version", "(", "self", ")", ":", "# TODO: Is there a better way to get the const char than allocating 30?", "VersionType", "=", "c_char", "*", "30", "return", "VersionType", ".", "in_dll", "(", "self", ".", "lib", ",", "\"version\"", ")", ".", "value", ...
Returns the version of the libiperf library :rtype: string
[ "Returns", "the", "version", "of", "the", "libiperf", "library" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L369-L376
thiezn/iperf3-python
iperf3/iperf3.py
IPerf3._error_to_string
def _error_to_string(self, error_id): """Returns an error string from libiperf :param error_id: The error_id produced by libiperf :rtype: string """ strerror = self.lib.iperf_strerror strerror.restype = c_char_p return strerror(error_id).decode('utf-8')
python
def _error_to_string(self, error_id): """Returns an error string from libiperf :param error_id: The error_id produced by libiperf :rtype: string """ strerror = self.lib.iperf_strerror strerror.restype = c_char_p return strerror(error_id).decode('utf-8')
[ "def", "_error_to_string", "(", "self", ",", "error_id", ")", ":", "strerror", "=", "self", ".", "lib", ".", "iperf_strerror", "strerror", ".", "restype", "=", "c_char_p", "return", "strerror", "(", "error_id", ")", ".", "decode", "(", "'utf-8'", ")" ]
Returns an error string from libiperf :param error_id: The error_id produced by libiperf :rtype: string
[ "Returns", "an", "error", "string", "from", "libiperf" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L378-L386
thiezn/iperf3-python
iperf3/iperf3.py
Client.server_hostname
def server_hostname(self): """The server hostname to connect to. Accepts DNS entries or IP addresses. :rtype: string """ result = c_char_p( self.lib.iperf_get_test_server_hostname(self._test) ).value if result: self._server_hostname = res...
python
def server_hostname(self): """The server hostname to connect to. Accepts DNS entries or IP addresses. :rtype: string """ result = c_char_p( self.lib.iperf_get_test_server_hostname(self._test) ).value if result: self._server_hostname = res...
[ "def", "server_hostname", "(", "self", ")", ":", "result", "=", "c_char_p", "(", "self", ".", "lib", ".", "iperf_get_test_server_hostname", "(", "self", ".", "_test", ")", ")", ".", "value", "if", "result", ":", "self", ".", "_server_hostname", "=", "resul...
The server hostname to connect to. Accepts DNS entries or IP addresses. :rtype: string
[ "The", "server", "hostname", "to", "connect", "to", "." ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L432-L446
thiezn/iperf3-python
iperf3/iperf3.py
Client.protocol
def protocol(self): """The iperf3 instance protocol valid protocols are 'tcp' and 'udp' :rtype: str """ proto_id = self.lib.iperf_get_test_protocol_id(self._test) if proto_id == SOCK_STREAM: self._protocol = 'tcp' elif proto_id == SOCK_DGRAM: ...
python
def protocol(self): """The iperf3 instance protocol valid protocols are 'tcp' and 'udp' :rtype: str """ proto_id = self.lib.iperf_get_test_protocol_id(self._test) if proto_id == SOCK_STREAM: self._protocol = 'tcp' elif proto_id == SOCK_DGRAM: ...
[ "def", "protocol", "(", "self", ")", ":", "proto_id", "=", "self", ".", "lib", ".", "iperf_get_test_protocol_id", "(", "self", ".", "_test", ")", "if", "proto_id", "==", "SOCK_STREAM", ":", "self", ".", "_protocol", "=", "'tcp'", "elif", "proto_id", "==", ...
The iperf3 instance protocol valid protocols are 'tcp' and 'udp' :rtype: str
[ "The", "iperf3", "instance", "protocol" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L457-L471
thiezn/iperf3-python
iperf3/iperf3.py
Client.omit
def omit(self): """The test startup duration to omit in seconds.""" self._omit = self.lib.iperf_get_test_omit(self._test) return self._omit
python
def omit(self): """The test startup duration to omit in seconds.""" self._omit = self.lib.iperf_get_test_omit(self._test) return self._omit
[ "def", "omit", "(", "self", ")", ":", "self", ".", "_omit", "=", "self", ".", "lib", ".", "iperf_get_test_omit", "(", "self", ".", "_test", ")", "return", "self", ".", "_omit" ]
The test startup duration to omit in seconds.
[ "The", "test", "startup", "duration", "to", "omit", "in", "seconds", "." ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L486-L489
thiezn/iperf3-python
iperf3/iperf3.py
Client.duration
def duration(self): """The test duration in seconds.""" self._duration = self.lib.iperf_get_test_duration(self._test) return self._duration
python
def duration(self): """The test duration in seconds.""" self._duration = self.lib.iperf_get_test_duration(self._test) return self._duration
[ "def", "duration", "(", "self", ")", ":", "self", ".", "_duration", "=", "self", ".", "lib", ".", "iperf_get_test_duration", "(", "self", ".", "_test", ")", "return", "self", ".", "_duration" ]
The test duration in seconds.
[ "The", "test", "duration", "in", "seconds", "." ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L497-L500
thiezn/iperf3-python
iperf3/iperf3.py
Client.bandwidth
def bandwidth(self): """Target bandwidth in bits/sec""" self._bandwidth = self.lib.iperf_get_test_rate(self._test) return self._bandwidth
python
def bandwidth(self): """Target bandwidth in bits/sec""" self._bandwidth = self.lib.iperf_get_test_rate(self._test) return self._bandwidth
[ "def", "bandwidth", "(", "self", ")", ":", "self", ".", "_bandwidth", "=", "self", ".", "lib", ".", "iperf_get_test_rate", "(", "self", ".", "_test", ")", "return", "self", ".", "_bandwidth" ]
Target bandwidth in bits/sec
[ "Target", "bandwidth", "in", "bits", "/", "sec" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L508-L511
thiezn/iperf3-python
iperf3/iperf3.py
Client.blksize
def blksize(self): """The test blksize.""" self._blksize = self.lib.iperf_get_test_blksize(self._test) return self._blksize
python
def blksize(self): """The test blksize.""" self._blksize = self.lib.iperf_get_test_blksize(self._test) return self._blksize
[ "def", "blksize", "(", "self", ")", ":", "self", ".", "_blksize", "=", "self", ".", "lib", ".", "iperf_get_test_blksize", "(", "self", ".", "_test", ")", "return", "self", ".", "_blksize" ]
The test blksize.
[ "The", "test", "blksize", "." ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L519-L522
thiezn/iperf3-python
iperf3/iperf3.py
Client.num_streams
def num_streams(self): """The number of streams to use.""" self._num_streams = self.lib.iperf_get_test_num_streams(self._test) return self._num_streams
python
def num_streams(self): """The number of streams to use.""" self._num_streams = self.lib.iperf_get_test_num_streams(self._test) return self._num_streams
[ "def", "num_streams", "(", "self", ")", ":", "self", ".", "_num_streams", "=", "self", ".", "lib", ".", "iperf_get_test_num_streams", "(", "self", ".", "_test", ")", "return", "self", ".", "_num_streams" ]
The number of streams to use.
[ "The", "number", "of", "streams", "to", "use", "." ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L552-L555
thiezn/iperf3-python
iperf3/iperf3.py
Client.reverse
def reverse(self): """Toggles direction of test :rtype: bool """ enabled = self.lib.iperf_get_test_reverse(self._test) if enabled: self._reverse = True else: self._reverse = False return self._reverse
python
def reverse(self): """Toggles direction of test :rtype: bool """ enabled = self.lib.iperf_get_test_reverse(self._test) if enabled: self._reverse = True else: self._reverse = False return self._reverse
[ "def", "reverse", "(", "self", ")", ":", "enabled", "=", "self", ".", "lib", ".", "iperf_get_test_reverse", "(", "self", ".", "_test", ")", "if", "enabled", ":", "self", ".", "_reverse", "=", "True", "else", ":", "self", ".", "_reverse", "=", "False", ...
Toggles direction of test :rtype: bool
[ "Toggles", "direction", "of", "test" ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L586-L598
thiezn/iperf3-python
iperf3/iperf3.py
Client.run
def run(self): """Run the current test client. :rtype: instance of :class:`TestResult` """ if self.json_output: output_to_pipe(self._pipe_in) # Disable stdout error = self.lib.iperf_run_client(self._test) if not self.iperf_version.startswith('iperf ...
python
def run(self): """Run the current test client. :rtype: instance of :class:`TestResult` """ if self.json_output: output_to_pipe(self._pipe_in) # Disable stdout error = self.lib.iperf_run_client(self._test) if not self.iperf_version.startswith('iperf ...
[ "def", "run", "(", "self", ")", ":", "if", "self", ".", "json_output", ":", "output_to_pipe", "(", "self", ".", "_pipe_in", ")", "# Disable stdout", "error", "=", "self", ".", "lib", ".", "iperf_run_client", "(", "self", ".", "_test", ")", "if", "not", ...
Run the current test client. :rtype: instance of :class:`TestResult`
[ "Run", "the", "current", "test", "client", "." ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L609-L634
thiezn/iperf3-python
iperf3/iperf3.py
Server.run
def run(self): """Run the iperf3 server instance. :rtype: instance of :class:`TestResult` """ def _run_in_thread(self, data_queue): """Runs the iperf_run_server :param data_queue: thread-safe queue """ output_to_pipe(self._pipe_in) # di...
python
def run(self): """Run the iperf3 server instance. :rtype: instance of :class:`TestResult` """ def _run_in_thread(self, data_queue): """Runs the iperf_run_server :param data_queue: thread-safe queue """ output_to_pipe(self._pipe_in) # di...
[ "def", "run", "(", "self", ")", ":", "def", "_run_in_thread", "(", "self", ",", "data_queue", ")", ":", "\"\"\"Runs the iperf_run_server\n\n :param data_queue: thread-safe queue\n \"\"\"", "output_to_pipe", "(", "self", ".", "_pipe_in", ")", "# disable...
Run the iperf3 server instance. :rtype: instance of :class:`TestResult`
[ "Run", "the", "iperf3", "server", "instance", "." ]
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L660-L707
joferkington/mplstereonet
mplstereonet/convenience_functions.py
subplots
def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, hemisphere='lower', projection='equal_area', **fig_kw): """ Identical to matplotlib.pyplot.subplots, except that this will default to producing equal-area stereonet axes. This prevents cons...
python
def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, hemisphere='lower', projection='equal_area', **fig_kw): """ Identical to matplotlib.pyplot.subplots, except that this will default to producing equal-area stereonet axes. This prevents cons...
[ "def", "subplots", "(", "nrows", "=", "1", ",", "ncols", "=", "1", ",", "sharex", "=", "False", ",", "sharey", "=", "False", ",", "squeeze", "=", "True", ",", "subplot_kw", "=", "None", ",", "hemisphere", "=", "'lower'", ",", "projection", "=", "'equ...
Identical to matplotlib.pyplot.subplots, except that this will default to producing equal-area stereonet axes. This prevents constantly doing: >>> fig, ax = plt.subplot(subplot_kw=dict(projection='stereonet')) or >>> fig = plt.figure() >>> ax = fig.add_subplot(111, projection='st...
[ "Identical", "to", "matplotlib", ".", "pyplot", ".", "subplots", "except", "that", "this", "will", "default", "to", "producing", "equal", "-", "area", "stereonet", "axes", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/convenience_functions.py#L1-L108
joferkington/mplstereonet
examples/fault_slip_plot.py
fault_and_striae_plot
def fault_and_striae_plot(ax, strikes, dips, rakes): """Makes a fault-and-striae plot (a.k.a. "Ball of String") for normal faults with the given strikes, dips, and rakes.""" # Plot the planes lines = ax.plane(strikes, dips, 'k-', lw=0.5) # Calculate the position of the rake of the lineations, but d...
python
def fault_and_striae_plot(ax, strikes, dips, rakes): """Makes a fault-and-striae plot (a.k.a. "Ball of String") for normal faults with the given strikes, dips, and rakes.""" # Plot the planes lines = ax.plane(strikes, dips, 'k-', lw=0.5) # Calculate the position of the rake of the lineations, but d...
[ "def", "fault_and_striae_plot", "(", "ax", ",", "strikes", ",", "dips", ",", "rakes", ")", ":", "# Plot the planes", "lines", "=", "ax", ".", "plane", "(", "strikes", ",", "dips", ",", "'k-'", ",", "lw", "=", "0.5", ")", "# Calculate the position of the rake...
Makes a fault-and-striae plot (a.k.a. "Ball of String") for normal faults with the given strikes, dips, and rakes.
[ "Makes", "a", "fault", "-", "and", "-", "striae", "plot", "(", "a", ".", "k", ".", "a", ".", "Ball", "of", "String", ")", "for", "normal", "faults", "with", "the", "given", "strikes", "dips", "and", "rakes", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/examples/fault_slip_plot.py#L35-L52
joferkington/mplstereonet
examples/fault_slip_plot.py
tangent_lineation_plot
def tangent_lineation_plot(ax, strikes, dips, rakes): """Makes a tangent lineation plot for normal faults with the given strikes, dips, and rakes.""" # Calculate the position of the rake of the lineations, but don't plot yet rake_x, rake_y = mplstereonet.rake(strikes, dips, rakes) # Calculate the d...
python
def tangent_lineation_plot(ax, strikes, dips, rakes): """Makes a tangent lineation plot for normal faults with the given strikes, dips, and rakes.""" # Calculate the position of the rake of the lineations, but don't plot yet rake_x, rake_y = mplstereonet.rake(strikes, dips, rakes) # Calculate the d...
[ "def", "tangent_lineation_plot", "(", "ax", ",", "strikes", ",", "dips", ",", "rakes", ")", ":", "# Calculate the position of the rake of the lineations, but don't plot yet", "rake_x", ",", "rake_y", "=", "mplstereonet", ".", "rake", "(", "strikes", ",", "dips", ",", ...
Makes a tangent lineation plot for normal faults with the given strikes, dips, and rakes.
[ "Makes", "a", "tangent", "lineation", "plot", "for", "normal", "faults", "with", "the", "given", "strikes", "dips", "and", "rakes", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/examples/fault_slip_plot.py#L54-L73
joferkington/mplstereonet
examples/parse_angelier_data.py
load
def load(): """Read data from a text file on disk.""" # Get the data file relative to this file's location... datadir = os.path.dirname(__file__) filename = os.path.join(datadir, 'angelier_data.txt') data = [] with open(filename, 'r') as infile: for line in infile: # Skip co...
python
def load(): """Read data from a text file on disk.""" # Get the data file relative to this file's location... datadir = os.path.dirname(__file__) filename = os.path.join(datadir, 'angelier_data.txt') data = [] with open(filename, 'r') as infile: for line in infile: # Skip co...
[ "def", "load", "(", ")", ":", "# Get the data file relative to this file's location...", "datadir", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "filename", "=", "os", ".", "path", ".", "join", "(", "datadir", ",", "'angelier_data.txt'", ")", ...
Read data from a text file on disk.
[ "Read", "data", "from", "a", "text", "file", "on", "disk", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/examples/parse_angelier_data.py#L32-L63
joferkington/mplstereonet
mplstereonet/contouring.py
_count_points
def _count_points(lons, lats, func, sigma, gridsize=(100,100), weights=None): """This function actually calculates the point density of the input ("lons" and "lats") points at a series of counter stations. Creates "gridsize" regular grid of counter stations in lat-long space, calculates the distance to ...
python
def _count_points(lons, lats, func, sigma, gridsize=(100,100), weights=None): """This function actually calculates the point density of the input ("lons" and "lats") points at a series of counter stations. Creates "gridsize" regular grid of counter stations in lat-long space, calculates the distance to ...
[ "def", "_count_points", "(", "lons", ",", "lats", ",", "func", ",", "sigma", ",", "gridsize", "=", "(", "100", ",", "100", ")", ",", "weights", "=", "None", ")", ":", "lons", "=", "np", ".", "atleast_1d", "(", "np", ".", "squeeze", "(", "lons", "...
This function actually calculates the point density of the input ("lons" and "lats") points at a series of counter stations. Creates "gridsize" regular grid of counter stations in lat-long space, calculates the distance to all input points at each counter station, and then calculates the density using "...
[ "This", "function", "actually", "calculates", "the", "point", "density", "of", "the", "input", "(", "lons", "and", "lats", ")", "points", "at", "a", "series", "of", "counter", "stations", ".", "Creates", "gridsize", "regular", "grid", "of", "counter", "stati...
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/contouring.py#L4-L47
joferkington/mplstereonet
mplstereonet/contouring.py
density_grid
def density_grid(*args, **kwargs): """ Estimates point density of the given linear orientation measurements (Interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on the `measurement` keyword argument.). Returns a regular (in lat-long space) grid of density estimates over a hem...
python
def density_grid(*args, **kwargs): """ Estimates point density of the given linear orientation measurements (Interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on the `measurement` keyword argument.). Returns a regular (in lat-long space) grid of density estimates over a hem...
[ "def", "density_grid", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "do_nothing", "(", "x", ",", "y", ")", ":", "return", "x", ",", "y", "measurement", "=", "kwargs", ".", "get", "(", "'measurement'", ",", "'poles'", ")", "gridsize", ...
Estimates point density of the given linear orientation measurements (Interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on the `measurement` keyword argument.). Returns a regular (in lat-long space) grid of density estimates over a hemispherical surface. Parameters -------...
[ "Estimates", "point", "density", "of", "the", "given", "linear", "orientation", "measurements", "(", "Interpreted", "as", "poles", "lines", "rakes", "or", "raw", "longitudes", "and", "latitudes", "based", "on", "the", "measurement", "keyword", "argument", ".", "...
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/contouring.py#L49-L170
joferkington/mplstereonet
mplstereonet/contouring.py
_exponential_kamb
def _exponential_kamb(cos_dist, sigma=3): """Kernel function from Vollmer for exponential smoothing.""" n = float(cos_dist.size) f = 2 * (1.0 + n / sigma**2) count = np.exp(f * (cos_dist - 1)) units = np.sqrt(n * (f/2.0 - 1) / f**2) return count, units
python
def _exponential_kamb(cos_dist, sigma=3): """Kernel function from Vollmer for exponential smoothing.""" n = float(cos_dist.size) f = 2 * (1.0 + n / sigma**2) count = np.exp(f * (cos_dist - 1)) units = np.sqrt(n * (f/2.0 - 1) / f**2) return count, units
[ "def", "_exponential_kamb", "(", "cos_dist", ",", "sigma", "=", "3", ")", ":", "n", "=", "float", "(", "cos_dist", ".", "size", ")", "f", "=", "2", "*", "(", "1.0", "+", "n", "/", "sigma", "**", "2", ")", "count", "=", "np", ".", "exp", "(", ...
Kernel function from Vollmer for exponential smoothing.
[ "Kernel", "function", "from", "Vollmer", "for", "exponential", "smoothing", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/contouring.py#L183-L189
joferkington/mplstereonet
mplstereonet/contouring.py
_linear_inverse_kamb
def _linear_inverse_kamb(cos_dist, sigma=3): """Kernel function from Vollmer for linear smoothing.""" n = float(cos_dist.size) radius = _kamb_radius(n, sigma) f = 2 / (1 - radius) cos_dist = cos_dist[cos_dist >= radius] count = (f * (cos_dist - radius)) return count, _kamb_units(n, radius)
python
def _linear_inverse_kamb(cos_dist, sigma=3): """Kernel function from Vollmer for linear smoothing.""" n = float(cos_dist.size) radius = _kamb_radius(n, sigma) f = 2 / (1 - radius) cos_dist = cos_dist[cos_dist >= radius] count = (f * (cos_dist - radius)) return count, _kamb_units(n, radius)
[ "def", "_linear_inverse_kamb", "(", "cos_dist", ",", "sigma", "=", "3", ")", ":", "n", "=", "float", "(", "cos_dist", ".", "size", ")", "radius", "=", "_kamb_radius", "(", "n", ",", "sigma", ")", "f", "=", "2", "/", "(", "1", "-", "radius", ")", ...
Kernel function from Vollmer for linear smoothing.
[ "Kernel", "function", "from", "Vollmer", "for", "linear", "smoothing", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/contouring.py#L191-L198
joferkington/mplstereonet
mplstereonet/contouring.py
_kamb_count
def _kamb_count(cos_dist, sigma=3): """Original Kamb kernel function (raw count within radius).""" n = float(cos_dist.size) dist = _kamb_radius(n, sigma) count = (cos_dist >= dist).astype(float) return count, _kamb_units(n, dist)
python
def _kamb_count(cos_dist, sigma=3): """Original Kamb kernel function (raw count within radius).""" n = float(cos_dist.size) dist = _kamb_radius(n, sigma) count = (cos_dist >= dist).astype(float) return count, _kamb_units(n, dist)
[ "def", "_kamb_count", "(", "cos_dist", ",", "sigma", "=", "3", ")", ":", "n", "=", "float", "(", "cos_dist", ".", "size", ")", "dist", "=", "_kamb_radius", "(", "n", ",", "sigma", ")", "count", "=", "(", "cos_dist", ">=", "dist", ")", ".", "astype"...
Original Kamb kernel function (raw count within radius).
[ "Original", "Kamb", "kernel", "function", "(", "raw", "count", "within", "radius", ")", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/contouring.py#L209-L214
joferkington/mplstereonet
mplstereonet/contouring.py
_schmidt_count
def _schmidt_count(cos_dist, sigma=None): """Schmidt (a.k.a. 1%) counting kernel function.""" radius = 0.01 count = ((1 - cos_dist) <= radius).astype(float) # To offset the count.sum() - 0.5 required for the kamb methods... count = 0.5 / count.size + count return count, (cos_dist.size * radius)
python
def _schmidt_count(cos_dist, sigma=None): """Schmidt (a.k.a. 1%) counting kernel function.""" radius = 0.01 count = ((1 - cos_dist) <= radius).astype(float) # To offset the count.sum() - 0.5 required for the kamb methods... count = 0.5 / count.size + count return count, (cos_dist.size * radius)
[ "def", "_schmidt_count", "(", "cos_dist", ",", "sigma", "=", "None", ")", ":", "radius", "=", "0.01", "count", "=", "(", "(", "1", "-", "cos_dist", ")", "<=", "radius", ")", ".", "astype", "(", "float", ")", "# To offset the count.sum() - 0.5 required for th...
Schmidt (a.k.a. 1%) counting kernel function.
[ "Schmidt", "(", "a", ".", "k", ".", "a", ".", "1%", ")", "counting", "kernel", "function", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/contouring.py#L216-L222
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes._get_core_transform
def _get_core_transform(self, resolution): """The projection for the stereonet as a matplotlib transform. This is primarily called by LambertAxes._set_lim_and_transforms.""" return self._base_transform(self._center_longitude, self._center_latitude, ...
python
def _get_core_transform(self, resolution): """The projection for the stereonet as a matplotlib transform. This is primarily called by LambertAxes._set_lim_and_transforms.""" return self._base_transform(self._center_longitude, self._center_latitude, ...
[ "def", "_get_core_transform", "(", "self", ",", "resolution", ")", ":", "return", "self", ".", "_base_transform", "(", "self", ".", "_center_longitude", ",", "self", ".", "_center_latitude", ",", "resolution", ")" ]
The projection for the stereonet as a matplotlib transform. This is primarily called by LambertAxes._set_lim_and_transforms.
[ "The", "projection", "for", "the", "stereonet", "as", "a", "matplotlib", "transform", ".", "This", "is", "primarily", "called", "by", "LambertAxes", ".", "_set_lim_and_transforms", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L55-L60
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes._get_affine_transform
def _get_affine_transform(self): """The affine portion of the base transform. This is called by LambertAxes._set_lim_and_transforms.""" # How big is the projected globe? # In the case of a stereonet, it's actually constant. xscale = yscale = self._scale # Create an affine...
python
def _get_affine_transform(self): """The affine portion of the base transform. This is called by LambertAxes._set_lim_and_transforms.""" # How big is the projected globe? # In the case of a stereonet, it's actually constant. xscale = yscale = self._scale # Create an affine...
[ "def", "_get_affine_transform", "(", "self", ")", ":", "# How big is the projected globe?", "# In the case of a stereonet, it's actually constant.", "xscale", "=", "yscale", "=", "self", ".", "_scale", "# Create an affine transform to stretch the projection from 0-1", "return", "Af...
The affine portion of the base transform. This is called by LambertAxes._set_lim_and_transforms.
[ "The", "affine", "portion", "of", "the", "base", "transform", ".", "This", "is", "called", "by", "LambertAxes", ".", "_set_lim_and_transforms", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L62-L72
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes._set_lim_and_transforms
def _set_lim_and_transforms(self): """Setup the key transforms for the axes.""" # Most of the transforms are set up correctly by LambertAxes LambertAxes._set_lim_and_transforms(self) # Transform for latitude ticks. These are typically unused, but just # in case we need them... ...
python
def _set_lim_and_transforms(self): """Setup the key transforms for the axes.""" # Most of the transforms are set up correctly by LambertAxes LambertAxes._set_lim_and_transforms(self) # Transform for latitude ticks. These are typically unused, but just # in case we need them... ...
[ "def", "_set_lim_and_transforms", "(", "self", ")", ":", "# Most of the transforms are set up correctly by LambertAxes", "LambertAxes", ".", "_set_lim_and_transforms", "(", "self", ")", "# Transform for latitude ticks. These are typically unused, but just", "# in case we need them...", ...
Setup the key transforms for the axes.
[ "Setup", "the", "key", "transforms", "for", "the", "axes", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L74-L101
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.set_longitude_grid
def set_longitude_grid(self, degrees): """ Set the number of degrees between each longitude grid. """ number = (360.0 / degrees) + 1 locs = np.linspace(-np.pi, np.pi, number, True)[1:] locs[-1] -= 0.01 # Workaround for "back" gridlines showing. self.xaxis.set_majo...
python
def set_longitude_grid(self, degrees): """ Set the number of degrees between each longitude grid. """ number = (360.0 / degrees) + 1 locs = np.linspace(-np.pi, np.pi, number, True)[1:] locs[-1] -= 0.01 # Workaround for "back" gridlines showing. self.xaxis.set_majo...
[ "def", "set_longitude_grid", "(", "self", ",", "degrees", ")", ":", "number", "=", "(", "360.0", "/", "degrees", ")", "+", "1", "locs", "=", "np", ".", "linspace", "(", "-", "np", ".", "pi", ",", "np", ".", "pi", ",", "number", ",", "True", ")", ...
Set the number of degrees between each longitude grid.
[ "Set", "the", "number", "of", "degrees", "between", "each", "longitude", "grid", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L103-L112
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.set_position
def set_position(self, pos, which='both'): """Identical to Axes.set_position (This docstring is overwritten).""" self._polar.set_position(pos, which) if self._overlay_axes is not None: self._overlay_axes.set_position(pos, which) LambertAxes.set_position(self, pos, which)
python
def set_position(self, pos, which='both'): """Identical to Axes.set_position (This docstring is overwritten).""" self._polar.set_position(pos, which) if self._overlay_axes is not None: self._overlay_axes.set_position(pos, which) LambertAxes.set_position(self, pos, which)
[ "def", "set_position", "(", "self", ",", "pos", ",", "which", "=", "'both'", ")", ":", "self", ".", "_polar", ".", "set_position", "(", "pos", ",", "which", ")", "if", "self", ".", "_overlay_axes", "is", "not", "None", ":", "self", ".", "_overlay_axes"...
Identical to Axes.set_position (This docstring is overwritten).
[ "Identical", "to", "Axes", ".", "set_position", "(", "This", "docstring", "is", "overwritten", ")", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L114-L119
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.set_rotation
def set_rotation(self, rotation): """Set the rotation of the stereonet in degrees clockwise from North.""" self._rotation = np.radians(rotation) self._polar.set_theta_offset(self._rotation + np.pi / 2.0) self.transData.invalidate() self.transAxes.invalidate() self._set_li...
python
def set_rotation(self, rotation): """Set the rotation of the stereonet in degrees clockwise from North.""" self._rotation = np.radians(rotation) self._polar.set_theta_offset(self._rotation + np.pi / 2.0) self.transData.invalidate() self.transAxes.invalidate() self._set_li...
[ "def", "set_rotation", "(", "self", ",", "rotation", ")", ":", "self", ".", "_rotation", "=", "np", ".", "radians", "(", "rotation", ")", "self", ".", "_polar", ".", "set_theta_offset", "(", "self", ".", "_rotation", "+", "np", ".", "pi", "/", "2.0", ...
Set the rotation of the stereonet in degrees clockwise from North.
[ "Set", "the", "rotation", "of", "the", "stereonet", "in", "degrees", "clockwise", "from", "North", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L124-L130
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.cla
def cla(self): """Identical to Axes.cla (This docstring is overwritten).""" Axes.cla(self) # Set grid defaults... self.set_longitude_grid(10) self.set_latitude_grid(10) self.set_longitude_grid_ends(80) # Hide all ticks and tick labels for the "native" lon and la...
python
def cla(self): """Identical to Axes.cla (This docstring is overwritten).""" Axes.cla(self) # Set grid defaults... self.set_longitude_grid(10) self.set_latitude_grid(10) self.set_longitude_grid_ends(80) # Hide all ticks and tick labels for the "native" lon and la...
[ "def", "cla", "(", "self", ")", ":", "Axes", ".", "cla", "(", "self", ")", "# Set grid defaults...", "self", ".", "set_longitude_grid", "(", "10", ")", "self", ".", "set_latitude_grid", "(", "10", ")", "self", ".", "set_longitude_grid_ends", "(", "80", ")"...
Identical to Axes.cla (This docstring is overwritten).
[ "Identical", "to", "Axes", ".", "cla", "(", "This", "docstring", "is", "overwritten", ")", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L140-L169
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.format_coord
def format_coord(self, x, y): """Format displayed coordinates during mouseover of axes.""" p, b = stereonet_math.geographic2plunge_bearing(x, y) s, d = stereonet_math.geographic2pole(x, y) pb = u'P/B={:0.0f}\u00b0/{:03.0f}\u00b0'.format(p[0], b[0]) sd = u'S/D={:03.0f}\u00b0/{:0.0...
python
def format_coord(self, x, y): """Format displayed coordinates during mouseover of axes.""" p, b = stereonet_math.geographic2plunge_bearing(x, y) s, d = stereonet_math.geographic2pole(x, y) pb = u'P/B={:0.0f}\u00b0/{:03.0f}\u00b0'.format(p[0], b[0]) sd = u'S/D={:03.0f}\u00b0/{:0.0...
[ "def", "format_coord", "(", "self", ",", "x", ",", "y", ")", ":", "p", ",", "b", "=", "stereonet_math", ".", "geographic2plunge_bearing", "(", "x", ",", "y", ")", "s", ",", "d", "=", "stereonet_math", ".", "geographic2pole", "(", "x", ",", "y", ")", ...
Format displayed coordinates during mouseover of axes.
[ "Format", "displayed", "coordinates", "during", "mouseover", "of", "axes", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L174-L180
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.grid
def grid(self, b=None, which='major', axis='both', kind='arbitrary', center=None, **kwargs): """ Usage is identical to a normal axes grid except for the ``kind`` and ``center`` kwargs. ``kind="polar"`` will add a polar overlay. The ``center`` and ``kind`` arguments allow y...
python
def grid(self, b=None, which='major', axis='both', kind='arbitrary', center=None, **kwargs): """ Usage is identical to a normal axes grid except for the ``kind`` and ``center`` kwargs. ``kind="polar"`` will add a polar overlay. The ``center`` and ``kind`` arguments allow y...
[ "def", "grid", "(", "self", ",", "b", "=", "None", ",", "which", "=", "'major'", ",", "axis", "=", "'both'", ",", "kind", "=", "'arbitrary'", ",", "center", "=", "None", ",", "*", "*", "kwargs", ")", ":", "grid_on", "=", "self", ".", "_gridOn", "...
Usage is identical to a normal axes grid except for the ``kind`` and ``center`` kwargs. ``kind="polar"`` will add a polar overlay. The ``center`` and ``kind`` arguments allow you to add a grid from a differently-centered stereonet. This is useful for making "polar stereonets" that stil...
[ "Usage", "is", "identical", "to", "a", "normal", "axes", "grid", "except", "for", "the", "kind", "and", "center", "kwargs", ".", "kind", "=", "polar", "will", "add", "a", "polar", "overlay", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L182-L229
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes._add_overlay
def _add_overlay(self, center): """ Add a grid from a differently-centered stereonet. This is useful for making "polar stereonets" that still use the same coordinate system as a standard stereonet. (i.e. a plane/line/whatever will have the same representation on both, but the gr...
python
def _add_overlay(self, center): """ Add a grid from a differently-centered stereonet. This is useful for making "polar stereonets" that still use the same coordinate system as a standard stereonet. (i.e. a plane/line/whatever will have the same representation on both, but the gr...
[ "def", "_add_overlay", "(", "self", ",", "center", ")", ":", "plunge", ",", "bearing", "=", "stereonet_math", ".", "geographic2plunge_bearing", "(", "*", "center", ")", "lon0", ",", "lat0", "=", "center", "fig", "=", "self", ".", "get_figure", "(", ")", ...
Add a grid from a differently-centered stereonet. This is useful for making "polar stereonets" that still use the same coordinate system as a standard stereonet. (i.e. a plane/line/whatever will have the same representation on both, but the grid is displayed differently.) To display a ...
[ "Add", "a", "grid", "from", "a", "differently", "-", "centered", "stereonet", ".", "This", "is", "useful", "for", "making", "polar", "stereonets", "that", "still", "use", "the", "same", "coordinate", "system", "as", "a", "standard", "stereonet", ".", "(", ...
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L233-L270
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes._polar
def _polar(self): """The "hidden" polar axis used for azimuth labels.""" # This will be called inside LambertAxes.__init__ as well as every # time the axis is cleared, so we need the try/except to avoid having # multiple hidden axes when `cla` is _manually_ called. try: ...
python
def _polar(self): """The "hidden" polar axis used for azimuth labels.""" # This will be called inside LambertAxes.__init__ as well as every # time the axis is cleared, so we need the try/except to avoid having # multiple hidden axes when `cla` is _manually_ called. try: ...
[ "def", "_polar", "(", "self", ")", ":", "# This will be called inside LambertAxes.__init__ as well as every", "# time the axis is cleared, so we need the try/except to avoid having", "# multiple hidden axes when `cla` is _manually_ called.", "try", ":", "return", "self", ".", "_hidden_po...
The "hidden" polar axis used for azimuth labels.
[ "The", "hidden", "polar", "axis", "used", "for", "azimuth", "labels", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L282-L294
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.set_azimuth_ticks
def set_azimuth_ticks(self, angles, labels=None, frac=None, **kwargs): """ Sets the azimuthal tick locations (Note: tick lines are not currently drawn or supported.). Parameters ---------- angles : sequence of numbers The tick locations in degrees. la...
python
def set_azimuth_ticks(self, angles, labels=None, frac=None, **kwargs): """ Sets the azimuthal tick locations (Note: tick lines are not currently drawn or supported.). Parameters ---------- angles : sequence of numbers The tick locations in degrees. la...
[ "def", "set_azimuth_ticks", "(", "self", ",", "angles", ",", "labels", "=", "None", ",", "frac", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_polar", ".", "set_thetagrids", "(", "angles", ",", "labels", ",", "frac", ",", "...
Sets the azimuthal tick locations (Note: tick lines are not currently drawn or supported.). Parameters ---------- angles : sequence of numbers The tick locations in degrees. labels : sequence of strings The tick label at each location. Defaults to a form...
[ "Sets", "the", "azimuthal", "tick", "locations", "(", "Note", ":", "tick", "lines", "are", "not", "currently", "drawn", "or", "supported", ".", ")", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L307-L325
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.set_azimuth_ticklabels
def set_azimuth_ticklabels(self, labels, fontdict=None, **kwargs): """ Sets the labels for the azimuthal ticks. Parameters ---------- labels : A sequence of strings Azimuth tick labels **kwargs Additional parameters are text properties for the lab...
python
def set_azimuth_ticklabels(self, labels, fontdict=None, **kwargs): """ Sets the labels for the azimuthal ticks. Parameters ---------- labels : A sequence of strings Azimuth tick labels **kwargs Additional parameters are text properties for the lab...
[ "def", "set_azimuth_ticklabels", "(", "self", ",", "labels", ",", "fontdict", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_polar", ".", "set_xticklabels", "(", "labels", ",", "fontdict", ",", "*", "*", "kwargs", ")" ]
Sets the labels for the azimuthal ticks. Parameters ---------- labels : A sequence of strings Azimuth tick labels **kwargs Additional parameters are text properties for the labels.
[ "Sets", "the", "labels", "for", "the", "azimuthal", "ticks", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L330-L341
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.cone
def cone(self, plunge, bearing, angle, segments=100, bidirectional=True, **kwargs): """ Plot a polygon of a small circle (a.k.a. a cone) with an angular radius of *angle* centered at a p/b of *plunge*, *bearing*. Additional keyword arguments are passed on to the ``PathCollec...
python
def cone(self, plunge, bearing, angle, segments=100, bidirectional=True, **kwargs): """ Plot a polygon of a small circle (a.k.a. a cone) with an angular radius of *angle* centered at a p/b of *plunge*, *bearing*. Additional keyword arguments are passed on to the ``PathCollec...
[ "def", "cone", "(", "self", ",", "plunge", ",", "bearing", ",", "angle", ",", "segments", "=", "100", ",", "bidirectional", "=", "True", ",", "*", "*", "kwargs", ")", ":", "plunge", ",", "bearing", ",", "angle", "=", "np", ".", "atleast_1d", "(", "...
Plot a polygon of a small circle (a.k.a. a cone) with an angular radius of *angle* centered at a p/b of *plunge*, *bearing*. Additional keyword arguments are passed on to the ``PathCollection``. (e.g. to have an unfilled small small circle, pass "facecolor='none'".) Parameters ...
[ "Plot", "a", "polygon", "of", "a", "small", "circle", "(", "a", ".", "k", ".", "a", ".", "a", "cone", ")", "with", "an", "angular", "radius", "of", "*", "angle", "*", "centered", "at", "a", "p", "/", "b", "of", "*", "plunge", "*", "*", "bearing...
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L347-L401
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.plane
def plane(self, strike, dip, *args, **kwargs): """ Plot lines representing planes on the axes. Additional arguments and keyword arguments are passed on to `ax.plot`. Parameters ---------- strike, dip : number or sequences of numbers The strike and dip of the ...
python
def plane(self, strike, dip, *args, **kwargs): """ Plot lines representing planes on the axes. Additional arguments and keyword arguments are passed on to `ax.plot`. Parameters ---------- strike, dip : number or sequences of numbers The strike and dip of the ...
[ "def", "plane", "(", "self", ",", "strike", ",", "dip", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "segments", "=", "kwargs", ".", "pop", "(", "'segments'", ",", "100", ")", "center", "=", "self", ".", "_center_latitude", ",", "self", "."...
Plot lines representing planes on the axes. Additional arguments and keyword arguments are passed on to `ax.plot`. Parameters ---------- strike, dip : number or sequences of numbers The strike and dip of the plane(s) in degrees. The dip direction is defined by th...
[ "Plot", "lines", "representing", "planes", "on", "the", "axes", ".", "Additional", "arguments", "and", "keyword", "arguments", "are", "passed", "on", "to", "ax", ".", "plot", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L403-L426
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.pole
def pole(self, strike, dip, *args, **kwargs): """ Plot points representing poles to planes on the axes. Additional arguments and keyword arguments are passed on to `ax.plot`. Parameters ---------- strike, dip : numbers or sequences of numbers The strike and d...
python
def pole(self, strike, dip, *args, **kwargs): """ Plot points representing poles to planes on the axes. Additional arguments and keyword arguments are passed on to `ax.plot`. Parameters ---------- strike, dip : numbers or sequences of numbers The strike and d...
[ "def", "pole", "(", "self", ",", "strike", ",", "dip", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lon", ",", "lat", "=", "stereonet_math", ".", "pole", "(", "strike", ",", "dip", ")", "args", ",", "kwargs", "=", "self", ".", "_point_pl...
Plot points representing poles to planes on the axes. Additional arguments and keyword arguments are passed on to `ax.plot`. Parameters ---------- strike, dip : numbers or sequences of numbers The strike and dip of the plane(s) in degrees. The dip direction is de...
[ "Plot", "points", "representing", "poles", "to", "planes", "on", "the", "axes", ".", "Additional", "arguments", "and", "keyword", "arguments", "are", "passed", "on", "to", "ax", ".", "plot", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L428-L448
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.rake
def rake(self, strike, dip, rake_angle, *args, **kwargs): """ Plot points representing lineations along planes on the axes. Additional arguments and keyword arguments are passed on to `plot`. Parameters ---------- strike, dip : number or sequences of numbers ...
python
def rake(self, strike, dip, rake_angle, *args, **kwargs): """ Plot points representing lineations along planes on the axes. Additional arguments and keyword arguments are passed on to `plot`. Parameters ---------- strike, dip : number or sequences of numbers ...
[ "def", "rake", "(", "self", ",", "strike", ",", "dip", ",", "rake_angle", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lon", ",", "lat", "=", "stereonet_math", ".", "rake", "(", "strike", ",", "dip", ",", "rake_angle", ")", "args", ",", ...
Plot points representing lineations along planes on the axes. Additional arguments and keyword arguments are passed on to `plot`. Parameters ---------- strike, dip : number or sequences of numbers The strike and dip of the plane(s) in degrees. The dip direction is ...
[ "Plot", "points", "representing", "lineations", "along", "planes", "on", "the", "axes", ".", "Additional", "arguments", "and", "keyword", "arguments", "are", "passed", "on", "to", "plot", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L450-L475
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.line
def line(self, plunge, bearing, *args, **kwargs): """ Plot points representing linear features on the axes. Additional arguments and keyword arguments are passed on to `plot`. Parameters ---------- plunge, bearing : number or sequence of numbers The plunge an...
python
def line(self, plunge, bearing, *args, **kwargs): """ Plot points representing linear features on the axes. Additional arguments and keyword arguments are passed on to `plot`. Parameters ---------- plunge, bearing : number or sequence of numbers The plunge an...
[ "def", "line", "(", "self", ",", "plunge", ",", "bearing", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lon", ",", "lat", "=", "stereonet_math", ".", "line", "(", "plunge", ",", "bearing", ")", "args", ",", "kwargs", "=", "self", ".", "_...
Plot points representing linear features on the axes. Additional arguments and keyword arguments are passed on to `plot`. Parameters ---------- plunge, bearing : number or sequence of numbers The plunge and bearing of the line(s) in degrees. The plunge is measur...
[ "Plot", "points", "representing", "linear", "features", "on", "the", "axes", ".", "Additional", "arguments", "and", "keyword", "arguments", "are", "passed", "on", "to", "plot", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L477-L498
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes._point_plot_defaults
def _point_plot_defaults(self, args, kwargs): """To avoid confusion for new users, this ensures that "scattered" points are plotted by by `plot` instead of points joined by a line. Parameters ---------- args : tuple Arguments representing additional parameters to be ...
python
def _point_plot_defaults(self, args, kwargs): """To avoid confusion for new users, this ensures that "scattered" points are plotted by by `plot` instead of points joined by a line. Parameters ---------- args : tuple Arguments representing additional parameters to be ...
[ "def", "_point_plot_defaults", "(", "self", ",", "args", ",", "kwargs", ")", ":", "if", "args", ":", "return", "args", ",", "kwargs", "if", "'ls'", "not", "in", "kwargs", "and", "'linestyle'", "not", "in", "kwargs", ":", "kwargs", "[", "'linestyle'", "]"...
To avoid confusion for new users, this ensures that "scattered" points are plotted by by `plot` instead of points joined by a line. Parameters ---------- args : tuple Arguments representing additional parameters to be passed to `self.plot`. kwargs : dict ...
[ "To", "avoid", "confusion", "for", "new", "users", "this", "ensures", "that", "scattered", "points", "are", "plotted", "by", "by", "plot", "instead", "of", "points", "joined", "by", "a", "line", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L500-L524
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes._contour_helper
def _contour_helper(self, args, kwargs): """Unify defaults and common functionality of ``density_contour`` and ``density_contourf``.""" contour_kwargs = {} contour_kwargs['measurement'] = kwargs.pop('measurement', 'poles') contour_kwargs['method'] = kwargs.pop('method', 'exponent...
python
def _contour_helper(self, args, kwargs): """Unify defaults and common functionality of ``density_contour`` and ``density_contourf``.""" contour_kwargs = {} contour_kwargs['measurement'] = kwargs.pop('measurement', 'poles') contour_kwargs['method'] = kwargs.pop('method', 'exponent...
[ "def", "_contour_helper", "(", "self", ",", "args", ",", "kwargs", ")", ":", "contour_kwargs", "=", "{", "}", "contour_kwargs", "[", "'measurement'", "]", "=", "kwargs", ".", "pop", "(", "'measurement'", ",", "'poles'", ")", "contour_kwargs", "[", "'method'"...
Unify defaults and common functionality of ``density_contour`` and ``density_contourf``.
[ "Unify", "defaults", "and", "common", "functionality", "of", "density_contour", "and", "density_contourf", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L526-L536
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.density_contour
def density_contour(self, *args, **kwargs): """ Estimates point density of the given linear orientation measurements (Interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on the `measurement` keyword argument.) and plots contour lines of the resulting densi...
python
def density_contour(self, *args, **kwargs): """ Estimates point density of the given linear orientation measurements (Interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on the `measurement` keyword argument.) and plots contour lines of the resulting densi...
[ "def", "density_contour", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lon", ",", "lat", ",", "totals", ",", "kwargs", "=", "self", ".", "_contour_helper", "(", "args", ",", "kwargs", ")", "return", "self", ".", "contour", "(", ...
Estimates point density of the given linear orientation measurements (Interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on the `measurement` keyword argument.) and plots contour lines of the resulting density distribution. Parameters ---------- ...
[ "Estimates", "point", "density", "of", "the", "given", "linear", "orientation", "measurements", "(", "Interpreted", "as", "poles", "lines", "rakes", "or", "raw", "longitudes", "and", "latitudes", "based", "on", "the", "measurement", "keyword", "argument", ".", "...
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L538-L675
joferkington/mplstereonet
mplstereonet/stereonet_axes.py
StereonetAxes.density_contourf
def density_contourf(self, *args, **kwargs): """ Estimates point density of the given linear orientation measurements (Interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on the `measurement` keyword argument.) and plots filled contours of the resulting de...
python
def density_contourf(self, *args, **kwargs): """ Estimates point density of the given linear orientation measurements (Interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on the `measurement` keyword argument.) and plots filled contours of the resulting de...
[ "def", "density_contourf", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lon", ",", "lat", ",", "totals", ",", "kwargs", "=", "self", ".", "_contour_helper", "(", "args", ",", "kwargs", ")", "return", "self", ".", "contourf", "("...
Estimates point density of the given linear orientation measurements (Interpreted as poles, lines, rakes, or "raw" longitudes and latitudes based on the `measurement` keyword argument.) and plots filled contours of the resulting density distribution. Parameters ---------- ...
[ "Estimates", "point", "density", "of", "the", "given", "linear", "orientation", "measurements", "(", "Interpreted", "as", "poles", "lines", "rakes", "or", "raw", "longitudes", "and", "latitudes", "based", "on", "the", "measurement", "keyword", "argument", ".", "...
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/stereonet_axes.py#L677-L816
joferkington/mplstereonet
examples/polar_overlay.py
basic
def basic(): """Set up a basic stereonet and plot the same data each time.""" fig, ax = mplstereonet.subplots() strike, dip = 315, 30 ax.plane(strike, dip, color='lightblue') ax.pole(strike, dip, color='green', markersize=15) ax.rake(strike, dip, 40, marker='*', markersize=20, color='green') ...
python
def basic(): """Set up a basic stereonet and plot the same data each time.""" fig, ax = mplstereonet.subplots() strike, dip = 315, 30 ax.plane(strike, dip, color='lightblue') ax.pole(strike, dip, color='green', markersize=15) ax.rake(strike, dip, 40, marker='*', markersize=20, color='green') ...
[ "def", "basic", "(", ")", ":", "fig", ",", "ax", "=", "mplstereonet", ".", "subplots", "(", ")", "strike", ",", "dip", "=", "315", ",", "30", "ax", ".", "plane", "(", "strike", ",", "dip", ",", "color", "=", "'lightblue'", ")", "ax", ".", "pole",...
Set up a basic stereonet and plot the same data each time.
[ "Set", "up", "a", "basic", "stereonet", "and", "plot", "the", "same", "data", "each", "time", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/examples/polar_overlay.py#L23-L35
joferkington/mplstereonet
examples/stereonet_explanation.py
setup_figure
def setup_figure(): """Setup the figure and axes""" fig, axes = mplstereonet.subplots(ncols=2, figsize=(20,10)) for ax in axes: # Make the grid lines solid. ax.grid(ls='-') # Make the longitude grids continue all the way to the poles ax.set_longitude_grid_ends(90) return ...
python
def setup_figure(): """Setup the figure and axes""" fig, axes = mplstereonet.subplots(ncols=2, figsize=(20,10)) for ax in axes: # Make the grid lines solid. ax.grid(ls='-') # Make the longitude grids continue all the way to the poles ax.set_longitude_grid_ends(90) return ...
[ "def", "setup_figure", "(", ")", ":", "fig", ",", "axes", "=", "mplstereonet", ".", "subplots", "(", "ncols", "=", "2", ",", "figsize", "=", "(", "20", ",", "10", ")", ")", "for", "ax", "in", "axes", ":", "# Make the grid lines solid.", "ax", ".", "g...
Setup the figure and axes
[ "Setup", "the", "figure", "and", "axes" ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/examples/stereonet_explanation.py#L17-L25
joferkington/mplstereonet
examples/stereonet_explanation.py
stereonet_projection_explanation
def stereonet_projection_explanation(ax): """Example to explain azimuth and dip on a lower-hemisphere stereonet.""" ax.set_title('Dip and Azimuth', y=1.1, size=18) # Set the azimuth ticks to be just "N", "E", etc. ax.set_azimuth_ticks(range(0, 360, 10)) # Hackishly set some of the azimuth labels t...
python
def stereonet_projection_explanation(ax): """Example to explain azimuth and dip on a lower-hemisphere stereonet.""" ax.set_title('Dip and Azimuth', y=1.1, size=18) # Set the azimuth ticks to be just "N", "E", etc. ax.set_azimuth_ticks(range(0, 360, 10)) # Hackishly set some of the azimuth labels t...
[ "def", "stereonet_projection_explanation", "(", "ax", ")", ":", "ax", ".", "set_title", "(", "'Dip and Azimuth'", ",", "y", "=", "1.1", ",", "size", "=", "18", ")", "# Set the azimuth ticks to be just \"N\", \"E\", etc.", "ax", ".", "set_azimuth_ticks", "(", "range"...
Example to explain azimuth and dip on a lower-hemisphere stereonet.
[ "Example", "to", "explain", "azimuth", "and", "dip", "on", "a", "lower", "-", "hemisphere", "stereonet", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/examples/stereonet_explanation.py#L27-L52
joferkington/mplstereonet
examples/stereonet_explanation.py
native_projection_explanation
def native_projection_explanation(ax): """Example showing how the "native" longitude and latitude relate to the stereonet projection.""" ax.set_title('Longitude and Latitude', size=18, y=1.1) # Hide the azimuth labels ax.set_azimuth_ticklabels([]) # Make the axis tick labels visible: ax.se...
python
def native_projection_explanation(ax): """Example showing how the "native" longitude and latitude relate to the stereonet projection.""" ax.set_title('Longitude and Latitude', size=18, y=1.1) # Hide the azimuth labels ax.set_azimuth_ticklabels([]) # Make the axis tick labels visible: ax.se...
[ "def", "native_projection_explanation", "(", "ax", ")", ":", "ax", ".", "set_title", "(", "'Longitude and Latitude'", ",", "size", "=", "18", ",", "y", "=", "1.1", ")", "# Hide the azimuth labels", "ax", ".", "set_azimuth_ticklabels", "(", "[", "]", ")", "# Ma...
Example showing how the "native" longitude and latitude relate to the stereonet projection.
[ "Example", "showing", "how", "the", "native", "longitude", "and", "latitude", "relate", "to", "the", "stereonet", "projection", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/examples/stereonet_explanation.py#L54-L69
joferkington/mplstereonet
examples/stereonet_explanation.py
xlabel_halo
def xlabel_halo(ax): """Add a white "halo" around the xlabels.""" import matplotlib.patheffects as effects for tick in ax.get_xticklabels() + [ax.xaxis.label]: tick.set_path_effects([effects.withStroke(linewidth=4, foreground='w')])
python
def xlabel_halo(ax): """Add a white "halo" around the xlabels.""" import matplotlib.patheffects as effects for tick in ax.get_xticklabels() + [ax.xaxis.label]: tick.set_path_effects([effects.withStroke(linewidth=4, foreground='w')])
[ "def", "xlabel_halo", "(", "ax", ")", ":", "import", "matplotlib", ".", "patheffects", "as", "effects", "for", "tick", "in", "ax", ".", "get_xticklabels", "(", ")", "+", "[", "ax", ".", "xaxis", ".", "label", "]", ":", "tick", ".", "set_path_effects", ...
Add a white "halo" around the xlabels.
[ "Add", "a", "white", "halo", "around", "the", "xlabels", "." ]
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/examples/stereonet_explanation.py#L71-L75