Skip to content

Commit

Permalink
more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
leliel12 committed Dec 8, 2017
1 parent 75e0022 commit 35700cc
Show file tree
Hide file tree
Showing 9 changed files with 344 additions and 227 deletions.
423 changes: 231 additions & 192 deletions doc/source/index.ipynb

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions doc/source/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ def as_table(features, values):
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#extractors" href="#collapse-feature-{{ name }}" aria-expanded="true" aria-controls="collapse-feature-{{ name }}">
Extractor <span class="text-info">{{ name }}</span>
<span class="pull-right">
{% for feature in fresume %}
<span class="label lb-lg feature-resume label-default">{{ feature }}</span>
{% endfor %}
</span>
</a>
</h4>
</div>
<div id="collapse-feature-{{ name }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-feature-{{ name }}">
Expand All @@ -151,14 +151,14 @@ def as_table(features, values):
<span class="label label-info">{{ data }}</span>
{% endfor %}
</div>
<h5>Full list of features</h5>
<div>
{% for feature in ext.get_features() %}
<span class="label label-default">{{ feature }}</span>
{% endfor %}
</div>
<h5>Dependencies</h5>
<div>
{% for dep in ext.get_dependencies() %}
Expand All @@ -178,11 +178,11 @@ def as_table(features, values):

def features_doc():
import feets

import rst2html5_

from docutils.core import publish_parts

rows = []
extractors = sorted({
e for e in feets.registered_extractors().values()})
Expand All @@ -191,15 +191,14 @@ def features_doc():

doc = publish_parts(
ext.__doc__ or name,
writer_name='html5',
writer_name='html5',
writer=rst2html5_.HTML5Writer())["body"]

features = ext.get_features()
data = sorted(ext.get_data(), key=feets.extractors.DATAS.index)

if len(features) > 4:
features = list(features)[:4] + ["..."]
rows.append((name, doc, ext, features, data))
rows.sort()
return HTML(DOC_TEMPLATE.render(rows=rows))

18 changes: 0 additions & 18 deletions feets/extractors/ext_car.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,6 @@ def _car_like(parameters, t, x, error_vars):
# =============================================================================

class CAR(Extractor):
r"""In order to model the irregular sampled times series we use CAR(
(Brockwell and Davis, 2002), a continious time auto regressive model.
CAR process has three parameters, it provides a natural and consistent
way of estimating a characteristic time scale and variance of light-curves.
CAR process is described by the following stochastic differential
equation:
.. math::
dX(t) = - \frac{1}{\tau} X(t)dt + \sigma_C \sqrt{dt} \epsilon(t) + bdt,
.. math::
for \: \tau, \sigma_C, t \geq 0
"""

data = ['magnitude', 'time', 'error']
features = ["CAR_sigma", "CAR_tau", "CAR_mean"]
Expand Down
16 changes: 15 additions & 1 deletion feets/extractors/ext_gskew.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,21 @@
# =============================================================================

class Gskew(Extractor):
"""Median-based measure of the skew"""
"""Median-of-magnitudes based measure of the skew.
.. math::
Gskew = m_{q3} + m_{q97} - 2m
Where:
- :math:`m_{q3}` is the median of magnitudes lesser or equal than the
quantile 3.
- :math:`m_{q97}` is the median of magnitudes greater or equal than the
quantile 97.
- :math:`m` is the median of magnitudes.
"""

data = ['magnitude']
features = ["Gskew"]
Expand Down
13 changes: 13 additions & 0 deletions feets/extractors/ext_linear_trend.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@
# =============================================================================

class LinearTrend(Extractor):
r"""
**LinearTrend**
Slope of a linear fit to the light-curve.
.. code-block:: pycon
>>> fs = feets.FeatureSpace(only=['LinearTrend'])
>>> features, values = fs.extract(**lc_normal)
>>> dict(zip(features, values))
{'LinearTrend': -3.2084065290292509e-06}
"""

data = ['magnitude', 'time']
features = ["LinearTrend"]
Expand Down
21 changes: 18 additions & 3 deletions feets/extractors/ext_max_slope.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,30 @@

class MaxSlope(Extractor):
"""
**MaxSlope**
Maximum absolute magnitude slope between two consecutive observations.
Examining successive (time-sorted) magnitudes, the maximal first difference
(value of delta magnitude over delta time)
.. code-block:: pycon
>>> fs = feets.FeatureSpace(only=['MaxSlope'])
>>> features, values = fs.extract(**lc_normal)
>>> dict(zip(features, values))
{'MaxSlope': 5.4943105823904741}
"""

data = ['magnitude', 'time']
features = ["MaxSlope"]
params = {"timesort": True}

def fit(self, magnitude, time):
slope = np.abs(magnitude[1:] - magnitude[:-1]) / (time[1:] - time[:-1])
np.max(slope)
def fit(self, magnitude, time, timesort):
if timesort:
sort = np.argsort(time)
time, magnitude = time[sort], magnitude[sort]

slope = np.abs(magnitude[1:] - magnitude[:-1]) / (time[1:] - time[:-1])
return {"MaxSlope": np.max(slope)}
14 changes: 14 additions & 0 deletions feets/extractors/ext_mean.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@
# =============================================================================

class Mean(Extractor):
r"""
**Mean**
Mean magnitude. For a normal distribution it should take a value
close to zero:
.. code-block:: pycon
>>> fs = feets.FeatureSpace(only=['Mean'])
>>> features, values = fs.extract(**lc_normal)
>>> dict(zip(features, values))
{'Mean': 0.0082611563419413246}
"""

data = ['magnitude']
features = ["Mean"]
Expand Down
21 changes: 20 additions & 1 deletion feets/extractors/ext_mean_variance.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,26 @@
# =============================================================================

class MeanVariance(Extractor):
"""variability index"""
"""
**Meanvariance** (:math:`\frac{\sigma}{\bar{m}}`)
This is a simple variability index and is defined as the ratio of the
standard deviation :math:`\sigma`, to the mean magnitude, :math:`\bar{m}`.
If a light curve has strong variability, :math:`\frac{\sigma}{\bar{m}}`
of the light curve is generally large.
For a uniform distribution from 0 to 1, the mean is equal to 0.5 and the
variance is equal to 1/12, thus the mean-variance should take a value
close to 0.577:
.. code-block:: pycon
>>> fs = feets.FeatureSpace(only=['Meanvariance'])
>>> features, values = fs.extract(**lc_uniform)
>>> dict(zip(features, values))
{'Meanvariance': 0.5816791217381897}
"""

data = ['magnitude']
features = ['Meanvariance']
Expand Down
24 changes: 23 additions & 1 deletion feets/extractors/ext_skew.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,29 @@
# =============================================================================

class Skew(Extractor):
"""Skewness of the magnitudes"""
r"""
**Skew**
The skewness of a sample is defined as follow:
.. math::
Skewness = \frac{N}{(N-1)(N-2)}
\sum_{i=1}^N (\frac{m_i-\hat{m}}{\sigma})^3
Example:
For a normal distribution it should be equal to zero:
.. code-block:: pycon
>>> fs = feets.FeatureSpace(only=['Skew'])
>>> features, values = fs.extract(**lc_normal)
>>> dict(zip(features, values))
{'Skew': -0.00023325826785278685}
"""

data = ['magnitude']
features = ["Skew"]
Expand Down

0 comments on commit 35700cc

Please sign in to comment.