text stringlengths 81 112k |
|---|
>>> [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]
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]
"""
... |
>>> [1, 4, 6, 4, 1] > take_until_including(X > 5) | list
[1, 4, 6]
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):
y... |
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... |
Greenwich mean sidereal utc_time, in radians.
As defined in the AIAA 2006 implementation:
http://www.celestrak.com/publications/AIAA/2006-6753/
def gmst(utc_time):
"""Greenwich mean sidereal utc_time, in radians.
As defined in the AIAA 2006 implementation:
http://www.celestrak.com/publications/AI... |
Ecliptic longitude of the sun at *utc_time*.
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 * j... |
Right ascension and declination of the sun at *utc_time*.
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 * jd... |
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!
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 ret... |
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.
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... |
Sun-zenith angle for *lon*, *lat* at *utc_time*.
lon,lat in degrees.
The angle returned is given in degrees
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.arcco... |
Calculate the sun earth distance correction, relative to 1 AU.
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 = 149597... |
Calculate observer ECI position.
http://celestrak.com/columns/v02n03/
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 /... |
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 time of last ascending node relative to the
specified 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 = ut... |
Get the cartesian position and velocity from the satellite.
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 /= XKMPE... |
Calculate sublon, sublat and altitude of satellite.
http://celestrak.com/columns/v02n03/
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_pos... |
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 orbit number at specified time.
Optionally use TBUS-style orbit numbering (TLE orbit number + 1)
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)
"""
ut... |
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... |
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'.
def _get_time_at_horizon(self, utc_tim... |
Get the point on the ellipsoid under the *query_point*.
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... |
Rotate *vector* around *axis* by *angle* (in radians).
*vector* is a matrix of column vectors, as is *axis*.
This function uses quaternion rotation.
def qrotate(vector, axis, angle):
"""Rotate *vector* around *axis* by *angle* (in radians).
*vector* is a matrix of column vectors, as is *axis*.
Th... |
Compute cartesian coordinates of the pixels in instrument scan.
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=tl... |
norm of a matrix of vectors stacked along the *axis* dimension.
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)) |
Get unit vectors pointing to the different pixels.
*pos* and *vel* are column vectors, or matrices of column
vectors. Returns vectors as stacked rows.
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 c... |
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
def avhrr(scans_nb, scan_points,
scan_angle=55.37, frequency=1 / 6.0, apply_offset=True):
"""Definition of the avhrr instrument.
Source: NOAA KL... |
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
def avhrr_gac(scan_times, scan_points,
scan_angle=55.37, frequency=0.5):
"""Definition of the avhrr instrument, gac version
Sour... |
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 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... |
Definition of the OLCI instrument.
Source: Sentinel-3 OLCI Coverage
https://sentinel.esa.int/web/sentinel/user-guides/sentinel-3-olci/coverage
def olci(scans_nb, scan_points=None):
"""Definition of the OLCI instrument.
Source: Sentinel-3 OLCI Coverage
https://sentinel.esa.int/web/sentinel/user-gu... |
ASCAT make two scans one to the left and one to the right of the
sub-satellite track.
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_p... |
Read platform numbers from $PPP_CONFIG_DIR/platforms.txt if available.
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_CON... |
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.
def read(platform, tle_file=None, line1=None, line2=None):
"""Read TLE for `platform` from `tle_file`
File is read from `line1` to `li... |
Fetch TLE from internet and save it to `destination`.
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... |
Performs the checksum for the current TLE.
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 ... |
Read TLE data.
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_fil... |
Parse values from TLE data.
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... |
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 ... |
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
d... |
For given navigator_id build app features
Returns dict {name, product_sub, vendor, build_version, build_id}
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 == 'f... |
Generate possible choices for the option `opt_name`
limited to `opt_value` value with default value
as `default_value`
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
... |
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... |
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 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 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... |
Check if there is more data left on the pipe
:param pipe_out: The os pipe_out
:rtype: bool
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) |
Read data on a pipe
Used to capture stdout data produced by libiperf
:param pipe_out: The os pipe_out
:rtype: unicode string
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
"""
... |
The iperf3 instance role
valid roles are 'c'=client and 's'=server
:rtype: 'c' or 's'
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.i... |
The bind address the iperf3 instance will listen on
use * to listen on all available IPs
:rtype: string
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(
... |
The port the iperf3 server is listening on
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 |
Toggles json output of libiperf
Turning this off will output the iperf3 instance results to
stdout/stderr
:rtype: bool
def json_output(self):
"""Toggles json output of libiperf
Turning this off will output the iperf3 instance results to
stdout/stderr
:rtype: ... |
Toggles verbose output for the iperf3 instance
:rtype: bool
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:
se... |
Returns the version of the libiperf library
:rtype: string
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 Versio... |
Returns an error string from libiperf
:param error_id: The error_id produced by libiperf
:rtype: 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... |
The server hostname to connect to.
Accepts DNS entries or IP addresses.
:rtype: string
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_t... |
The iperf3 instance protocol
valid protocols are 'tcp' and 'udp'
:rtype: str
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_i... |
The test startup duration to omit in seconds.
def omit(self):
"""The test startup duration to omit in seconds."""
self._omit = self.lib.iperf_get_test_omit(self._test)
return self._omit |
The test duration in seconds.
def duration(self):
"""The test duration in seconds."""
self._duration = self.lib.iperf_get_test_duration(self._test)
return self._duration |
Target bandwidth in bits/sec
def bandwidth(self):
"""Target bandwidth in bits/sec"""
self._bandwidth = self.lib.iperf_get_test_rate(self._test)
return self._bandwidth |
The test blksize.
def blksize(self):
"""The test blksize."""
self._blksize = self.lib.iperf_get_test_blksize(self._test)
return self._blksize |
The number of streams to use.
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 |
Toggles direction of test
:rtype: bool
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 s... |
Run the current test client.
:rtype: instance of :class:`TestResult`
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_r... |
Run the iperf3 server instance.
:rtype: instance of :class:`TestResult`
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:... |
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... |
Makes a fault-and-striae plot (a.k.a. "Ball of String") for normal faults
with the given strikes, dips, and rakes.
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 pla... |
Makes a tangent lineation plot for normal faults with the given strikes,
dips, and rakes.
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... |
Read data from a text file on disk.
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 ... |
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 "... |
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
-------... |
Kernel function from Vollmer for exponential smoothing.
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... |
Kernel function from Vollmer for linear smoothing.
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 -... |
Original Kamb kernel function (raw count within radius).
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) |
Schmidt (a.k.a. 1%) counting kernel function.
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 + co... |
The projection for the stereonet as a matplotlib transform. This is
primarily called by LambertAxes._set_lim_and_transforms.
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.... |
The affine portion of the base transform. This is called by
LambertAxes._set_lim_and_transforms.
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 cas... |
Setup the key transforms for the axes.
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 ... |
Set the number of degrees between each 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 f... |
Identical to Axes.set_position (This docstring is overwritten).
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(po... |
Set the rotation of the stereonet in degrees clockwise from North.
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.i... |
Identical to Axes.cla (This docstring is overwritten).
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)
# Hi... |
Format displayed coordinates during mouseover of axes.
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'.fo... |
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... |
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 ... |
The "hidden" polar axis used for azimuth labels.
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 ... |
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 labels for the azimuthal ticks.
Parameters
----------
labels : A sequence of strings
Azimuth tick labels
**kwargs
Additional parameters are text properties for the labels.
def set_azimuth_ticklabels(self, labels, fontdict=None, **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 ``PathCollection``. (e.g. to have an
unfilled small small circle, pass "facecolor='none'".)
Parameters
... |
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 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 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 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... |
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
... |
Unify defaults and common functionality of ``density_contour`` and
``density_contourf``.
def _contour_helper(self, args, kwargs):
"""Unify defaults and common functionality of ``density_contour`` and
``density_contourf``."""
contour_kwargs = {}
contour_kwargs['measurement'] = kw... |
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.) and plots filled contours
of the resulting density distribution.
Parameters
----------
... |
Set up a basic stereonet and plot the same data each time.
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(s... |
Setup the figure and axes
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_longitud... |
Example to explain azimuth and dip on a lower-hemisphere stereonet.
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... |
Example showing how the "native" longitude and latitude relate to the
stereonet projection.
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 azi... |
Add a white "halo" around the xlabels.
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')]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.