Skip to content

Commit

Permalink
Made a simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
NickSwainston committed Jan 26, 2022
1 parent c5a093b commit f4555af
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 6 deletions.
7 changes: 7 additions & 0 deletions docs/example_scripts/simple_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from pulsar_spectra.catalogues import collect_catalogue_fluxes
from pulsar_spectra.spectral_fit import find_best_spectral_fit

cat_list = collect_catalogue_fluxes()
pulsar = 'J1453-6413'
freqs, fluxs, flux_errs, refs = cat_list[pulsar]
find_best_spectral_fit(pulsar, freqs, fluxs, flux_errs, refs, plot_best=True)
32 changes: 32 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Examples
========

Simple example
--------------

The following can be run to fit J1453-6413

.. code-block:: python
from pulsar_spectra.catalogues import collect_catalogue_fluxes
from pulsar_spectra.spectral_fit import find_best_spectral_fit
cat_list = collect_catalogue_fluxes()
pulsar = 'J1453-6413'
freqs, fluxs, flux_errs, refs = cat_list[pulsar]
find_best_spectral_fit(pulsar, freqs, fluxs, flux_errs, refs, plot_best=True)
This will produce J1453-6413_simple_power_law_fit.png

.. image:: figures/J1453-6413_simple_power_law_fit.png
:width: 800

.. code-block:: bash
python setup.py install
or

.. code-block:: bash
pip install .
Binary file added docs/figures/J1453-6413_simple_power_law_fit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ Welcome to pulsar_spectra's documentation!
==========================================

.. toctree::
:maxdepth: 1
:maxdepth: 2
:caption: Contents:
:glob:

installation
examples
modules
10 changes: 5 additions & 5 deletions docs/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@

<br />

=======================
**************************************
pulsar\_spectra modules
=======================
**************************************

catalogues
----------
==========

.. automodule:: pulsar_spectra.catalogues
:members:

models
------
======

.. automodule:: pulsar_spectra.models
:members:

spectral_fit
------------
============

.. automodule:: pulsar_spectra.spectral_fit
:members:

0 comments on commit f4555af

Please sign in to comment.