Skip to content

Commit

Permalink
a lot
Browse files Browse the repository at this point in the history
  • Loading branch information
leliel12 committed Nov 23, 2017
1 parent 624fe67 commit 24fb37b
Show file tree
Hide file tree
Showing 7 changed files with 2,074 additions and 410 deletions.
2 changes: 2 additions & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ numpydoc==0.7.0
six
nbsphinx
seaborn
ExpectException
sphinx_bootstrap_theme
14 changes: 7 additions & 7 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
import sphinx_bootstrap_theme
html_theme = 'bootstrap'
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()

html_logo = "_static/logo_medium.png"

html_theme_options = {
'fixed_sidebar': True,
'logo': 'logo_medium.png',
'github_user': 'bitprophet',
'github_repo': 'alabaster',
'page_width': "92%",
'logo_name': False
'navbar_pagenav_name': "Content",
'bootswatch_theme': "cerulean",
}

if on_rtd:
Expand Down
2,341 changes: 1,951 additions & 390 deletions doc/source/index.ipynb

Large diffs are not rendered by default.

66 changes: 54 additions & 12 deletions doc/source/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,55 @@ def as_table(features, values):
rows = zip(features, values)
return HTML(RESULT_TABLE_TEMPLATE.render(rows=rows))


DOC_TEMPLATE = jinja2.Template("""
<div class="features-doc">
<ol>
{% for name, doc in rows %}
<li class="extractor {{ name }}">
<div>
<h3>Extractor <code>{{ name }}</code>.</h3>
<p>{{ doc }}</p>
</div>
</li>
{% endfor %}
</ol>
<div class="panel-group" id="extractors" role="tablist" aria-multiselectable="true">
{% for name, doc, ext, fresume, datas in rows %}
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading-feature-{{ name }}">
<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 }}">
<div class="panel-body">
<p>{{ doc }}</p>
<h5>Required Data</h5>
<div>
{% for data in datas %}
<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() %}
<span class="label label-warning">{{ dep }}</span>
{% else %}
-
{% endfor %}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
""")

Expand All @@ -151,6 +187,12 @@ def features_doc():
name = ext.__name__
doc = publish_parts(ext.__doc__ or name,
writer_name='html')["html_body"]
rows.append((name, doc))
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))

9 changes: 8 additions & 1 deletion feets/extractors/ext_amplitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@
# =============================================================================

class Amplitude(Extractor):
"""Half the difference between the maximum and the minimum magnitude"""
"""
**Amplitude**
The amplitude is defined as the half of the difference between the median
of the maximum 5% and the median of the minimum 5% magnitudes. For a
sequence of numbers from 0 to 1000 the amplitude should be equal to 475.5.
"""

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

class AndersonDarling(Extractor):
"""
**AndersonDarling**
The Anderson-Darling test is a statistical test of whether a given
sample of data is drawn from a given probability distribution. When
applied to testing if a normal distribution adequately describes a set of
data, it is one of the most powerful statistical tools for detecting most
departures from normality.
For a normal distribution the Anderson-Darling statistic should take values
close to 0.25.
"""

data = ['magnitude']
features = ["AndersonDarling"]
Expand Down
39 changes: 39 additions & 0 deletions feets/extractors/ext_lomb_scargle.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,45 @@ def fap(power, fmax, time, mag, method, normalization, method_kwds=None):
# =============================================================================

class LombScargle(Extractor):
"""
**PeriodLS**
The Lomb-Scargle (L-S) algorithm (Scargle, 1982) is a variation of the
Discrete Fourier Transform (DFT), in which a time series is decomposed
into a linear combination of sinusoidal functions. The basis of sinusoidal
functions transforms the data from the time domain to the frequency domain.
DFT techniques often assume evenly spaced data points in the time series,
but this is rarely the case with astrophysical time-series data. Scargle
has derived a formula for transform coefficients that is similiar to the
DFT in the limit of evenly spaced observations. In addition, an adjustment
of the values used to calculate the transform coefficients makes the
transform invariant to time shifts.
The Lomb-Scargle periodogram is optimized to identify sinusoidal-shaped
periodic signals in time-series data. Particular applications include
radial velocity data and searches for pulsating variable stars. L-S is not
optimal for detecting signals from transiting exoplanets, where the shape
of the periodic light-curve is not sinusoidal.
Next, we perform a test on the synthetic periodic light-curve we created
(which period is 20) to confirm the accuracy of the period found by the
L-S method
**Period_fit**
The false alarm probability of the largest periodogram value. Let's
test it for a normal distributed data and for a periodic one.
**Psi_CS** (:math:`\Psi_{CS}`)
:math:`R_{CS}` applied to the phase-folded light curve (generated using
the period estimated from the Lomb-Scargle method).
**Psi_eta** (:math:`\Psi_{\eta}`)
:math:`\eta^e` index calculated from the folded light curve.
"""

data = ['magnitude', 'time']
features = ["PeriodLS", "Period_fit", "Psi_CS", "Psi_eta"]
Expand Down

0 comments on commit 24fb37b

Please sign in to comment.