sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
def _dump_point(obj, big_endian, meta):
"""
Dump a GeoJSON-like `dict` to a point WKB string.
:param dict obj:
GeoJson-like `dict` object.
:param bool big_endian:
If `True`, data values in the generated WKB will be represented using
big endian byte order. Else, little endian.
... | Dump a GeoJSON-like `dict` to a point WKB string.
:param dict obj:
GeoJson-like `dict` object.
:param bool big_endian:
If `True`, data values in the generated WKB will be represented using
big endian byte order. Else, little endian.
:param dict meta:
Metadata associated with... | entailment |
def _dump_linestring(obj, big_endian, meta):
"""
Dump a GeoJSON-like `dict` to a linestring WKB string.
Input parameters and output are similar to :func:`_dump_point`.
"""
coords = obj['coordinates']
vertex = coords[0]
# Infer the number of dimensions from the first vertex
num_dims = le... | Dump a GeoJSON-like `dict` to a linestring WKB string.
Input parameters and output are similar to :func:`_dump_point`. | entailment |
def _dump_multipoint(obj, big_endian, meta):
"""
Dump a GeoJSON-like `dict` to a multipoint WKB string.
Input parameters and output are similar to :funct:`_dump_point`.
"""
coords = obj['coordinates']
vertex = coords[0]
num_dims = len(vertex)
wkb_string, byte_fmt, byte_order = _header_... | Dump a GeoJSON-like `dict` to a multipoint WKB string.
Input parameters and output are similar to :funct:`_dump_point`. | entailment |
def _dump_multilinestring(obj, big_endian, meta):
"""
Dump a GeoJSON-like `dict` to a multilinestring WKB string.
Input parameters and output are similar to :funct:`_dump_point`.
"""
coords = obj['coordinates']
vertex = coords[0][0]
num_dims = len(vertex)
wkb_string, byte_fmt, byte_ord... | Dump a GeoJSON-like `dict` to a multilinestring WKB string.
Input parameters and output are similar to :funct:`_dump_point`. | entailment |
def _dump_multipolygon(obj, big_endian, meta):
"""
Dump a GeoJSON-like `dict` to a multipolygon WKB string.
Input parameters and output are similar to :funct:`_dump_point`.
"""
coords = obj['coordinates']
vertex = coords[0][0][0]
num_dims = len(vertex)
wkb_string, byte_fmt, byte_order ... | Dump a GeoJSON-like `dict` to a multipolygon WKB string.
Input parameters and output are similar to :funct:`_dump_point`. | entailment |
def _load_point(big_endian, type_bytes, data_bytes):
"""
Convert byte data for a Point to a GeoJSON `dict`.
:param bool big_endian:
If `True`, interpret the ``data_bytes`` in big endian order, else
little endian.
:param str type_bytes:
4-byte integer (as a binary string) indicat... | Convert byte data for a Point to a GeoJSON `dict`.
:param bool big_endian:
If `True`, interpret the ``data_bytes`` in big endian order, else
little endian.
:param str type_bytes:
4-byte integer (as a binary string) indicating the geometry type
(Point) and the dimensions (2D, Z, ... | entailment |
def dumps(obj, decimals=16):
"""
Dump a GeoJSON-like `dict` to a WKT string.
"""
try:
geom_type = obj['type']
exporter = _dumps_registry.get(geom_type)
if exporter is None:
_unsupported_geom_type(geom_type)
# Check for empty cases
if geom_type == 'Ge... | Dump a GeoJSON-like `dict` to a WKT string. | entailment |
def loads(string):
"""
Construct a GeoJSON `dict` from WKT (`string`).
"""
sio = StringIO.StringIO(string)
# NOTE: This is not the intended purpose of `tokenize`, but it works.
tokens = (x[1] for x in tokenize.generate_tokens(sio.readline))
tokens = _tokenize_wkt(tokens)
geom_type_or_sri... | Construct a GeoJSON `dict` from WKT (`string`). | entailment |
def _tokenize_wkt(tokens):
"""
Since the tokenizer treats "-" and numeric strings as separate values,
combine them and yield them as a single token. This utility encapsulates
parsing of negative numeric values from WKT can be used generically in all
parsers.
"""
negative = False
for t in... | Since the tokenizer treats "-" and numeric strings as separate values,
combine them and yield them as a single token. This utility encapsulates
parsing of negative numeric values from WKT can be used generically in all
parsers. | entailment |
def _round_and_pad(value, decimals):
"""
Round the input value to `decimals` places, and pad with 0's
if the resulting value is less than `decimals`.
:param value:
The value to round
:param decimals:
Number of decimals places which should be displayed after the rounding.
:return... | Round the input value to `decimals` places, and pad with 0's
if the resulting value is less than `decimals`.
:param value:
The value to round
:param decimals:
Number of decimals places which should be displayed after the rounding.
:return:
str of the rounded value | entailment |
def _dump_point(obj, decimals):
"""
Dump a GeoJSON-like Point object to WKT.
:param dict obj:
A GeoJSON-like `dict` representing a Point.
:param int decimals:
int which indicates the number of digits to display after the
decimal point when formatting coordinates.
:returns:
... | Dump a GeoJSON-like Point object to WKT.
:param dict obj:
A GeoJSON-like `dict` representing a Point.
:param int decimals:
int which indicates the number of digits to display after the
decimal point when formatting coordinates.
:returns:
WKT representation of the input GeoJ... | entailment |
def _dump_linestring(obj, decimals):
"""
Dump a GeoJSON-like LineString object to WKT.
Input parameters and return value are the LINESTRING equivalent to
:func:`_dump_point`.
"""
coords = obj['coordinates']
ls = 'LINESTRING (%s)'
ls %= ', '.join(' '.join(_round_and_pad(c, decimals)
... | Dump a GeoJSON-like LineString object to WKT.
Input parameters and return value are the LINESTRING equivalent to
:func:`_dump_point`. | entailment |
def _dump_polygon(obj, decimals):
"""
Dump a GeoJSON-like Polygon object to WKT.
Input parameters and return value are the POLYGON equivalent to
:func:`_dump_point`.
"""
coords = obj['coordinates']
poly = 'POLYGON (%s)'
rings = (', '.join(' '.join(_round_and_pad(c, decimals)
... | Dump a GeoJSON-like Polygon object to WKT.
Input parameters and return value are the POLYGON equivalent to
:func:`_dump_point`. | entailment |
def _dump_multipoint(obj, decimals):
"""
Dump a GeoJSON-like MultiPoint object to WKT.
Input parameters and return value are the MULTIPOINT equivalent to
:func:`_dump_point`.
"""
coords = obj['coordinates']
mp = 'MULTIPOINT (%s)'
points = (' '.join(_round_and_pad(c, decimals)
... | Dump a GeoJSON-like MultiPoint object to WKT.
Input parameters and return value are the MULTIPOINT equivalent to
:func:`_dump_point`. | entailment |
def _dump_multilinestring(obj, decimals):
"""
Dump a GeoJSON-like MultiLineString object to WKT.
Input parameters and return value are the MULTILINESTRING equivalent to
:func:`_dump_point`.
"""
coords = obj['coordinates']
mlls = 'MULTILINESTRING (%s)'
linestrs = ('(%s)' % ', '.join(' '.... | Dump a GeoJSON-like MultiLineString object to WKT.
Input parameters and return value are the MULTILINESTRING equivalent to
:func:`_dump_point`. | entailment |
def _dump_multipolygon(obj, decimals):
"""
Dump a GeoJSON-like MultiPolygon object to WKT.
Input parameters and return value are the MULTIPOLYGON equivalent to
:func:`_dump_point`.
"""
coords = obj['coordinates']
mp = 'MULTIPOLYGON (%s)'
polys = (
# join the polygons in the mul... | Dump a GeoJSON-like MultiPolygon object to WKT.
Input parameters and return value are the MULTIPOLYGON equivalent to
:func:`_dump_point`. | entailment |
def _dump_geometrycollection(obj, decimals):
"""
Dump a GeoJSON-like GeometryCollection object to WKT.
Input parameters and return value are the GEOMETRYCOLLECTION equivalent to
:func:`_dump_point`.
The WKT conversions for each geometry in the collection are delegated to
their respective funct... | Dump a GeoJSON-like GeometryCollection object to WKT.
Input parameters and return value are the GEOMETRYCOLLECTION equivalent to
:func:`_dump_point`.
The WKT conversions for each geometry in the collection are delegated to
their respective functions. | entailment |
def _load_point(tokens, string):
"""
:param tokens:
A generator of string tokens for the input WKT, begining just after the
geometry type. The geometry type is consumed before we get to here. For
example, if :func:`loads` is called with the input 'POINT(0.0 1.0)',
``tokens`` woul... | :param tokens:
A generator of string tokens for the input WKT, begining just after the
geometry type. The geometry type is consumed before we get to here. For
example, if :func:`loads` is called with the input 'POINT(0.0 1.0)',
``tokens`` would generate the following values:
.. ... | entailment |
def _load_linestring(tokens, string):
"""
Has similar inputs and return value to to :func:`_load_point`, except is
for handling LINESTRING geometry.
:returns:
A GeoJSON `dict` LineString representation of the WKT ``string``.
"""
if not next(tokens) == '(':
raise ValueError(INVAL... | Has similar inputs and return value to to :func:`_load_point`, except is
for handling LINESTRING geometry.
:returns:
A GeoJSON `dict` LineString representation of the WKT ``string``. | entailment |
def _load_polygon(tokens, string):
"""
Has similar inputs and return value to to :func:`_load_point`, except is
for handling POLYGON geometry.
:returns:
A GeoJSON `dict` Polygon representation of the WKT ``string``.
"""
open_parens = next(tokens), next(tokens)
if not open_parens == ... | Has similar inputs and return value to to :func:`_load_point`, except is
for handling POLYGON geometry.
:returns:
A GeoJSON `dict` Polygon representation of the WKT ``string``. | entailment |
def _load_multipoint(tokens, string):
"""
Has similar inputs and return value to to :func:`_load_point`, except is
for handling MULTIPOINT geometry.
:returns:
A GeoJSON `dict` MultiPoint representation of the WKT ``string``.
"""
open_paren = next(tokens)
if not open_paren == '(':
... | Has similar inputs and return value to to :func:`_load_point`, except is
for handling MULTIPOINT geometry.
:returns:
A GeoJSON `dict` MultiPoint representation of the WKT ``string``. | entailment |
def _load_multipolygon(tokens, string):
"""
Has similar inputs and return value to to :func:`_load_point`, except is
for handling MULTIPOLYGON geometry.
:returns:
A GeoJSON `dict` MultiPolygon representation of the WKT ``string``.
"""
open_paren = next(tokens)
if not open_paren == '... | Has similar inputs and return value to to :func:`_load_point`, except is
for handling MULTIPOLYGON geometry.
:returns:
A GeoJSON `dict` MultiPolygon representation of the WKT ``string``. | entailment |
def _load_multilinestring(tokens, string):
"""
Has similar inputs and return value to to :func:`_load_point`, except is
for handling MULTILINESTRING geometry.
:returns:
A GeoJSON `dict` MultiLineString representation of the WKT ``string``.
"""
open_paren = next(tokens)
if not open_p... | Has similar inputs and return value to to :func:`_load_point`, except is
for handling MULTILINESTRING geometry.
:returns:
A GeoJSON `dict` MultiLineString representation of the WKT ``string``. | entailment |
def _load_geometrycollection(tokens, string):
"""
Has similar inputs and return value to to :func:`_load_point`, except is
for handling GEOMETRYCOLLECTIONs.
Delegates parsing to the parsers for the individual geometry types.
:returns:
A GeoJSON `dict` GeometryCollection representation of t... | Has similar inputs and return value to to :func:`_load_point`, except is
for handling GEOMETRYCOLLECTIONs.
Delegates parsing to the parsers for the individual geometry types.
:returns:
A GeoJSON `dict` GeometryCollection representation of the WKT
``string``. | entailment |
def _get_request_params(self, **kwargs):
"""Merge shared params and new params."""
request_params = copy.deepcopy(self._shared_request_params)
for key, value in iteritems(kwargs):
if isinstance(value, dict) and key in request_params:
# ensure we don't lose dict values... | Merge shared params and new params. | entailment |
def _sanitize_request_params(self, request_params):
"""Remove keyword arguments not used by `requests`"""
if 'verify_ssl' in request_params:
request_params['verify'] = request_params.pop('verify_ssl')
return dict((key, val) for key, val in request_params.items()
i... | Remove keyword arguments not used by `requests` | entailment |
def request(self, method, path, **kwargs):
"""Send a :class:`requests.Request` and demand a
:class:`requests.Response`
"""
if path:
url = '%s/%s' % (self.url.rstrip('/'), path.lstrip('/'))
else:
url = self.url
request_params = self._get_request_pa... | Send a :class:`requests.Request` and demand a
:class:`requests.Response` | entailment |
def pre_send(self, request_params):
"""Override this method to modify sent request parameters"""
for adapter in itervalues(self.adapters):
adapter.max_retries = request_params.get('max_retries', 0)
return request_params | Override this method to modify sent request parameters | entailment |
def is_acceptable(self, response, request_params):
"""
Override this method to create a different definition of
what kind of response is acceptable.
If `bool(the_return_value) is False` then an `HTTPServiceError`
will be raised.
For example, you might want to assert that... | Override this method to create a different definition of
what kind of response is acceptable.
If `bool(the_return_value) is False` then an `HTTPServiceError`
will be raised.
For example, you might want to assert that the body must be empty,
so you could return `len(response.cont... | entailment |
def _roundSlist(slist):
""" Rounds a signed list over the last element and removes it. """
slist[-1] = 60 if slist[-1] >= 30 else 0
for i in range(len(slist)-1, 1, -1):
if slist[i] == 60:
slist[i] = 0
slist[i-1] += 1
return slist[:-1] | Rounds a signed list over the last element and removes it. | entailment |
def strSlist(string):
""" Converts angle string to signed list. """
sign = '-' if string[0] == '-' else '+'
values = [abs(int(x)) for x in string.split(':')]
return _fixSlist(list(sign) + values) | Converts angle string to signed list. | entailment |
def slistStr(slist):
""" Converts signed list to angle string. """
slist = _fixSlist(slist)
string = ':'.join(['%02d' % x for x in slist[1:]])
return slist[0] + string | Converts signed list to angle string. | entailment |
def slistFloat(slist):
""" Converts signed list to float. """
values = [v / 60**(i) for (i,v) in enumerate(slist[1:])]
value = sum(values)
return -value if slist[0] == '-' else value | Converts signed list to float. | entailment |
def floatSlist(value):
""" Converts float to signed list. """
slist = ['+', 0, 0, 0, 0]
if value < 0:
slist[0] = '-'
value = abs(value)
for i in range(1,5):
slist[i] = math.floor(value)
value = (value - slist[i]) * 60
return _roundSlist(slist) | Converts float to signed list. | entailment |
def toFloat(value):
""" Converts string or signed list to float. """
if isinstance(value, str):
return strFloat(value)
elif isinstance(value, list):
return slistFloat(value)
else:
return value | Converts string or signed list to float. | entailment |
def inDignities(self, idA, idB):
""" Returns the dignities of A which belong to B. """
objA = self.chart.get(idA)
info = essential.getInfo(objA.sign, objA.signlon)
# Should we ignore exile and fall?
return [dign for (dign, ID) in info.items() if ID == idB] | Returns the dignities of A which belong to B. | entailment |
def receives(self, idA, idB):
""" Returns the dignities where A receives B.
A receives B when (1) B aspects A and (2) B is in
dignities of A.
"""
objA = self.chart.get(idA)
objB = self.chart.get(idB)
asp = aspects.isAspecting(objB, objA, const.MAJOR_ASPECTS)
... | Returns the dignities where A receives B.
A receives B when (1) B aspects A and (2) B is in
dignities of A. | entailment |
def mutualReceptions(self, idA, idB):
""" Returns all pairs of dignities in mutual reception. """
AB = self.receives(idA, idB)
BA = self.receives(idB, idA)
# Returns a product of both lists
return [(a,b) for a in AB for b in BA] | Returns all pairs of dignities in mutual reception. | entailment |
def reMutualReceptions(self, idA, idB):
""" Returns ruler and exaltation mutual receptions. """
mr = self.mutualReceptions(idA, idB)
filter_ = ['ruler', 'exalt']
# Each pair of dignities must be 'ruler' or 'exalt'
return [(a,b) for (a,b) in mr if (a in filter_ and b in filter_)] | Returns ruler and exaltation mutual receptions. | entailment |
def validAspects(self, ID, aspList):
""" Returns a list with the aspects an object
makes with the other six planets, considering a
list of possible aspects.
"""
obj = self.chart.getObject(ID)
res = []
for otherID in const.LIST_SEVEN_PLANETS:
... | Returns a list with the aspects an object
makes with the other six planets, considering a
list of possible aspects. | entailment |
def aspectsByCat(self, ID, aspList):
""" Returns the aspects an object makes with the
other six planets, separated by category (applicative,
separative, exact).
Aspects must be within orb of the object.
"""
res = {
const.APPLICATIVE: [],
... | Returns the aspects an object makes with the
other six planets, separated by category (applicative,
separative, exact).
Aspects must be within orb of the object. | entailment |
def immediateAspects(self, ID, aspList):
""" Returns the last separation and next application
considering a list of possible aspects.
"""
asps = self.aspectsByCat(ID, aspList)
applications = asps[const.APPLICATIVE]
separations = asps[const.SEPARATIVE]
exact = as... | Returns the last separation and next application
considering a list of possible aspects. | entailment |
def isVOC(self, ID):
""" Returns if a planet is Void of Course.
A planet is not VOC if has any exact or applicative aspects
ignoring the sign status (associate or dissociate).
"""
asps = self.aspectsByCat(ID, const.MAJOR_ASPECTS)
applications = asps[const.APPLICA... | Returns if a planet is Void of Course.
A planet is not VOC if has any exact or applicative aspects
ignoring the sign status (associate or dissociate). | entailment |
def singleFactor(factors, chart, factor, obj, aspect=None):
"""" Single factor for the table. """
objID = obj if type(obj) == str else obj.id
res = {
'factor': factor,
'objID': objID,
'aspect': aspect
}
# For signs (obj as string) return sign element
if type(obj... | Single factor for the table. | entailment |
def modifierFactor(chart, factor, factorObj, otherObj, aspList):
""" Computes a factor for a modifier. """
asp = aspects.aspectType(factorObj, otherObj, aspList)
if asp != const.NO_ASPECT:
return {
'factor': factor,
'aspect': asp,
'objID': otherObj.id,
... | Computes a factor for a modifier. | entailment |
def getFactors(chart):
""" Returns the factors for the temperament. """
factors = []
# Asc sign
asc = chart.getAngle(const.ASC)
singleFactor(factors, chart, ASC_SIGN, asc.sign)
# Asc ruler
ascRulerID = essential.ruler(asc.sign)
ascRuler = chart.getObject(ascRulerID)
si... | Returns the factors for the temperament. | entailment |
def getModifiers(chart):
""" Returns the factors of the temperament modifiers. """
modifiers = []
# Factors which can be affected
asc = chart.getAngle(const.ASC)
ascRulerID = essential.ruler(asc.sign)
ascRuler = chart.getObject(ascRulerID)
moon = chart.getObject(const.MOON)
fac... | Returns the factors of the temperament modifiers. | entailment |
def scores(factors):
""" Computes the score of temperaments
and elements.
"""
temperaments = {
const.CHOLERIC: 0,
const.MELANCHOLIC: 0,
const.SANGUINE: 0,
const.PHLEGMATIC: 0
}
qualities = {
const.HOT: 0,
const.COLD: 0,
... | Computes the score of temperaments
and elements. | entailment |
def getObject(ID, date, pos):
""" Returns an ephemeris object. """
obj = eph.getObject(ID, date.jd, pos.lat, pos.lon)
return Object.fromDict(obj) | Returns an ephemeris object. | entailment |
def getObjectList(IDs, date, pos):
""" Returns a list of objects. """
objList = [getObject(ID, date, pos) for ID in IDs]
return ObjectList(objList) | Returns a list of objects. | entailment |
def getHouses(date, pos, hsys):
""" Returns the lists of houses and angles.
Since houses and angles are computed at the
same time, this function should be fast.
"""
houses, angles = eph.getHouses(date.jd, pos.lat, pos.lon, hsys)
hList = [House.fromDict(house) for house in houses]
a... | Returns the lists of houses and angles.
Since houses and angles are computed at the
same time, this function should be fast. | entailment |
def getFixedStar(ID, date):
""" Returns a fixed star from the ephemeris. """
star = eph.getFixedStar(ID, date.jd)
return FixedStar.fromDict(star) | Returns a fixed star from the ephemeris. | entailment |
def getFixedStarList(IDs, date):
""" Returns a list of fixed stars. """
starList = [getFixedStar(ID, date) for ID in IDs]
return FixedStarList(starList) | Returns a list of fixed stars. | entailment |
def nextSolarReturn(date, lon):
""" Returns the next date when sun is at longitude 'lon'. """
jd = eph.nextSolarReturn(date.jd, lon)
return Datetime.fromJD(jd, date.utcoffset) | Returns the next date when sun is at longitude 'lon'. | entailment |
def prevSolarReturn(date, lon):
""" Returns the previous date when sun is at longitude 'lon'. """
jd = eph.prevSolarReturn(date.jd, lon)
return Datetime.fromJD(jd, date.utcoffset) | Returns the previous date when sun is at longitude 'lon'. | entailment |
def nextSunrise(date, pos):
""" Returns the date of the next sunrise. """
jd = eph.nextSunrise(date.jd, pos.lat, pos.lon)
return Datetime.fromJD(jd, date.utcoffset) | Returns the date of the next sunrise. | entailment |
def nextStation(ID, date):
""" Returns the aproximate date of the next station. """
jd = eph.nextStation(ID, date.jd)
return Datetime.fromJD(jd, date.utcoffset) | Returns the aproximate date of the next station. | entailment |
def prevSolarEclipse(date):
""" Returns the Datetime of the maximum phase of the
previous global solar eclipse.
"""
eclipse = swe.solarEclipseGlobal(date.jd, backward=True)
return Datetime.fromJD(eclipse['maximum'], date.utcoffset) | Returns the Datetime of the maximum phase of the
previous global solar eclipse. | entailment |
def nextSolarEclipse(date):
""" Returns the Datetime of the maximum phase of the
next global solar eclipse.
"""
eclipse = swe.solarEclipseGlobal(date.jd, backward=False)
return Datetime.fromJD(eclipse['maximum'], date.utcoffset) | Returns the Datetime of the maximum phase of the
next global solar eclipse. | entailment |
def prevLunarEclipse(date):
""" Returns the Datetime of the maximum phase of the
previous global lunar eclipse.
"""
eclipse = swe.lunarEclipseGlobal(date.jd, backward=True)
return Datetime.fromJD(eclipse['maximum'], date.utcoffset) | Returns the Datetime of the maximum phase of the
previous global lunar eclipse. | entailment |
def nextLunarEclipse(date):
""" Returns the Datetime of the maximum phase of the
next global lunar eclipse.
"""
eclipse = swe.lunarEclipseGlobal(date.jd, backward=False)
return Datetime.fromJD(eclipse['maximum'], date.utcoffset) | Returns the Datetime of the maximum phase of the
next global lunar eclipse. | entailment |
def plot(hdiff, title):
""" Plots the tropical solar length
by year.
"""
import matplotlib.pyplot as plt
years = [elem[0] for elem in hdiff]
diffs = [elem[1] for elem in hdiff]
plt.plot(years, diffs)
plt.ylabel('Distance in minutes')
plt.xlabel('Year')
plt.title(title)
p... | Plots the tropical solar length
by year. | entailment |
def ascdiff(decl, lat):
""" Returns the Ascensional Difference of a point. """
delta = math.radians(decl)
phi = math.radians(lat)
ad = math.asin(math.tan(delta) * math.tan(phi))
return math.degrees(ad) | Returns the Ascensional Difference of a point. | entailment |
def dnarcs(decl, lat):
""" Returns the diurnal and nocturnal arcs of a point. """
dArc = 180 + 2 * ascdiff(decl, lat)
nArc = 360 - dArc
return (dArc, nArc) | Returns the diurnal and nocturnal arcs of a point. | entailment |
def isAboveHorizon(ra, decl, mcRA, lat):
""" Returns if an object's 'ra' and 'decl'
is above the horizon at a specific latitude,
given the MC's right ascension.
"""
# This function checks if the equatorial distance from
# the object to the MC is within its diurnal semi-arc.
dArc... | Returns if an object's 'ra' and 'decl'
is above the horizon at a specific latitude,
given the MC's right ascension. | entailment |
def eqCoords(lon, lat):
""" Converts from ecliptical to equatorial coordinates.
This algorithm is described in book 'Primary Directions',
pp. 147-150.
"""
# Convert to radians
_lambda = math.radians(lon)
_beta = math.radians(lat)
_epson = math.radians(23.44) # The earth's inclina... | Converts from ecliptical to equatorial coordinates.
This algorithm is described in book 'Primary Directions',
pp. 147-150. | entailment |
def sunRelation(obj, sun):
""" Returns an object's relation with the sun. """
if obj.id == const.SUN:
return None
dist = abs(angle.closestdistance(sun.lon, obj.lon))
if dist < 0.2833: return CAZIMI
elif dist < 8.0: return COMBUST
elif dist < 16.0: return UNDER_SUN
else:
retur... | Returns an object's relation with the sun. | entailment |
def light(obj, sun):
""" Returns if an object is augmenting or diminishing light. """
dist = angle.distance(sun.lon, obj.lon)
faster = sun if sun.lonspeed > obj.lonspeed else obj
if faster == sun:
return LIGHT_DIMINISHING if dist < 180 else LIGHT_AUGMENTING
else:
return LIGHT_AUGMENT... | Returns if an object is augmenting or diminishing light. | entailment |
def orientality(obj, sun):
""" Returns if an object is oriental or
occidental to the sun.
"""
dist = angle.distance(sun.lon, obj.lon)
return OCCIDENTAL if dist < 180 else ORIENTAL | Returns if an object is oriental or
occidental to the sun. | entailment |
def haiz(obj, chart):
""" Returns if an object is in Haiz. """
objGender = obj.gender()
objFaction = obj.faction()
if obj.id == const.MERCURY:
# Gender and faction of mercury depends on orientality
sun = chart.getObject(const.SUN)
orientalityM = orientality(obj, sun)
... | Returns if an object is in Haiz. | entailment |
def house(self):
""" Returns the object's house. """
house = self.chart.houses.getObjectHouse(self.obj)
return house | Returns the object's house. | entailment |
def sunRelation(self):
""" Returns the relation of the object with the sun. """
sun = self.chart.getObject(const.SUN)
return sunRelation(self.obj, sun) | Returns the relation of the object with the sun. | entailment |
def light(self):
""" Returns if object is augmenting or diminishing its
light.
"""
sun = self.chart.getObject(const.SUN)
return light(self.obj, sun) | Returns if object is augmenting or diminishing its
light. | entailment |
def orientality(self):
""" Returns the orientality of the object. """
sun = self.chart.getObject(const.SUN)
return orientality(self.obj, sun) | Returns the orientality of the object. | entailment |
def inHouseJoy(self):
""" Returns if the object is in its house of joy. """
house = self.house()
return props.object.houseJoy[self.obj.id] == house.id | Returns if the object is in its house of joy. | entailment |
def inSignJoy(self):
""" Returns if the object is in its sign of joy. """
return props.object.signJoy[self.obj.id] == self.obj.sign | Returns if the object is in its sign of joy. | entailment |
def reMutualReceptions(self):
""" Returns all mutual receptions with the object
and other planets, indexed by planet ID.
It only includes ruler and exaltation receptions.
"""
planets = copy(const.LIST_SEVEN_PLANETS)
planets.remove(self.obj.id)
mrs = {}
... | Returns all mutual receptions with the object
and other planets, indexed by planet ID.
It only includes ruler and exaltation receptions. | entailment |
def eqMutualReceptions(self):
""" Returns a list with mutual receptions with the
object and other planets, when the reception is the
same for both (both ruler or both exaltation).
It basically return a list with every ruler-ruler and
exalt-exalt mutual receptions
... | Returns a list with mutual receptions with the
object and other planets, when the reception is the
same for both (both ruler or both exaltation).
It basically return a list with every ruler-ruler and
exalt-exalt mutual receptions | entailment |
def __aspectLists(self, IDs, aspList):
""" Returns a list with the aspects that the object
makes to the objects in IDs. It considers only
conjunctions and other exact/applicative aspects
if in aspList.
"""
res = []
for otherID in IDs:
... | Returns a list with the aspects that the object
makes to the objects in IDs. It considers only
conjunctions and other exact/applicative aspects
if in aspList. | entailment |
def aspectBenefics(self):
""" Returns a list with the good aspects the object
makes to the benefics.
"""
benefics = [const.VENUS, const.JUPITER]
return self.__aspectLists(benefics, aspList=[0, 60, 120]) | Returns a list with the good aspects the object
makes to the benefics. | entailment |
def aspectMalefics(self):
""" Returns a list with the bad aspects the object
makes to the malefics.
"""
malefics = [const.MARS, const.SATURN]
return self.__aspectLists(malefics, aspList=[0, 90, 180]) | Returns a list with the bad aspects the object
makes to the malefics. | entailment |
def __sepApp(self, IDs, aspList):
""" Returns true if the object last and next movement are
separations and applications to objects in list IDs.
It only considers aspects in aspList.
This function is static since it does not test if the next
application will be indeed pe... | Returns true if the object last and next movement are
separations and applications to objects in list IDs.
It only considers aspects in aspList.
This function is static since it does not test if the next
application will be indeed perfected. It considers only
a snapshot ... | entailment |
def isAuxilied(self):
""" Returns if the object is separating and applying to
a benefic considering good aspects.
"""
benefics = [const.VENUS, const.JUPITER]
return self.__sepApp(benefics, aspList=[0, 60, 120]) | Returns if the object is separating and applying to
a benefic considering good aspects. | entailment |
def isSurrounded(self):
""" Returns if the object is separating and applying to
a malefic considering bad aspects.
"""
malefics = [const.MARS, const.SATURN]
return self.__sepApp(malefics, aspList=[0, 90, 180]) | Returns if the object is separating and applying to
a malefic considering bad aspects. | entailment |
def isConjNorthNode(self):
""" Returns if object is conjunct north node. """
node = self.chart.getObject(const.NORTH_NODE)
return aspects.hasAspect(self.obj, node, aspList=[0]) | Returns if object is conjunct north node. | entailment |
def isConjSouthNode(self):
""" Returns if object is conjunct south node. """
node = self.chart.getObject(const.SOUTH_NODE)
return aspects.hasAspect(self.obj, node, aspList=[0]) | Returns if object is conjunct south node. | entailment |
def isFeral(self):
""" Returns true if the object does not have any
aspects.
"""
planets = copy(const.LIST_SEVEN_PLANETS)
planets.remove(self.obj.id)
for otherID in planets:
otherObj = self.chart.getObject(otherID)
if aspects.hasAspect(se... | Returns true if the object does not have any
aspects. | entailment |
def getScoreProperties(self):
""" Returns the accidental dignity score of the object
as dict.
"""
obj = self.obj
score = {}
# Peregrine
isPeregrine = essential.isPeregrine(obj.id, obj.sign, obj.signlon)
score['peregrine'] = -5 if isPere... | Returns the accidental dignity score of the object
as dict. | entailment |
def getActiveProperties(self):
""" Returns the non-zero accidental dignities. """
score = self.getScoreProperties()
return {key: value for (key, value) in score.items()
if value != 0} | Returns the non-zero accidental dignities. | entailment |
def score(self):
""" Returns the sum of the accidental dignities
score.
"""
if not self.scoreProperties:
self.scoreProperties = self.getScoreProperties()
return sum(self.scoreProperties.values()) | Returns the sum of the accidental dignities
score. | entailment |
def fromDict(cls, _dict):
""" Builds instance from dictionary of properties. """
obj = cls()
obj.__dict__.update(_dict)
return obj | Builds instance from dictionary of properties. | entailment |
def eqCoords(self, zerolat=False):
""" Returns the Equatorial Coordinates of this object.
Receives a boolean parameter to consider a zero latitude.
"""
lat = 0.0 if zerolat else self.lat
return utils.eqCoords(self.lon, lat) | Returns the Equatorial Coordinates of this object.
Receives a boolean parameter to consider a zero latitude. | entailment |
def relocate(self, lon):
""" Relocates this object to a new longitude. """
self.lon = angle.norm(lon)
self.signlon = self.lon % 30
self.sign = const.LIST_SIGNS[int(self.lon / 30.0)] | Relocates this object to a new longitude. | entailment |
def antiscia(self):
""" Returns antiscia object. """
obj = self.copy()
obj.type = const.OBJ_GENERIC
obj.relocate(360 - obj.lon + 180)
return obj | Returns antiscia object. | entailment |
def movement(self):
""" Returns if this object is direct, retrograde
or stationary.
"""
if abs(self.lonspeed) < 0.0003:
return const.STATIONARY
elif self.lonspeed > 0:
return const.DIRECT
else:
return const.RETROGRADE | Returns if this object is direct, retrograde
or stationary. | entailment |
def inHouse(self, lon):
""" Returns if a longitude belongs to this house. """
dist = angle.distance(self.lon + House._OFFSET, lon)
return dist < self.size | Returns if a longitude belongs to this house. | entailment |
def orb(self):
""" Returns the orb of this fixed star. """
for (mag, orb) in FixedStar._ORBS:
if self.mag < mag:
return orb
return 0.5 | Returns the orb of this fixed star. | entailment |
def aspects(self, obj):
""" Returns true if this star aspects another object.
Fixed stars only aspect by conjunctions.
"""
dist = angle.closestdistance(self.lon, obj.lon)
return abs(dist) < self.orb() | Returns true if this star aspects another object.
Fixed stars only aspect by conjunctions. | entailment |
def getObjectsInHouse(self, house):
""" Returns a list with all objects in a house. """
res = [obj for obj in self if house.hasObject(obj)]
return ObjectList(res) | Returns a list with all objects in a house. | entailment |
def getObjectsAspecting(self, point, aspList):
""" Returns a list of objects aspecting a point
considering a list of possible aspects.
"""
res = []
for obj in self:
if obj.isPlanet() and aspects.isAspecting(obj, point, aspList):
res.append(ob... | Returns a list of objects aspecting a point
considering a list of possible aspects. | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.