my_package modules

data_processing functions

my_package.data_processing.filter_by_declination(df, min_dec=-90, max_dec=90)[source]

Filters the DataFrame by declination.

Parameters:
dfpandas.DataFrame

Pandas DataFrame containing the pulsar data with RA and Dec in degrees.

min_decfloat

Minimum declination to filter by.

max_decfloat

Maximum declination to filter by.

Returns:
dfpandas.DataFrame

Pandas DataFrame containing the pulsar data with RA and Dec in degrees. Filtered by declination.

my_package.data_processing.filter_by_name(df, source_names)[source]

Filters the DataFrame by source name.

Parameters:
dfpandas.DataFrame

Pandas DataFrame containing the pulsar data with RA and Dec in degrees.

source_nameslist of str

A list of source names to filter the DataFrame by.

Returns:
dfpandas.DataFrame

Pandas DataFrame containing the pulsar data with RA and Dec in degrees. Filtered by source name.

my_package.data_processing.input_data(csv_path='/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/my_package/data/pulsars.csv')[source]

Reads the CSV file and returns a DataFrame with the RA and Dec converted to degrees.

Parameters:
csv_pathstr

Path to the CSV file containing the pulsar data. If none provided will use the pulsar data included with the package.

Returns:
dfpandas.DataFrame

Pandas DataFrame containing the pulsar data with RA and Dec in degrees.

plotting functions

my_package.plotting.molleweide_plot(df)[source]

Plots the pulsars in a Molleweide projection and saves as a png called pulsar_plot.png.

Parameters:
dfpandas.DataFrame

Pandas DataFrame containing the pulsar data with RA and Dec in degrees.

my_file functions

Docstring for the my_file.py module.

Modules names should have short, all-lowercase names. The module name may have underscores if this improves readability.

Every module should have a docstring at the very top of the file. The module’s docstring may extend over multiple lines. If your docstring does extend over multiple lines, the closing three quotation marks must be on a line by itself, preferably preceded by a blank line.

my_package.my_file.documentation_example(var1, var2, *args, long_var_name='hi', **kwargs)[source]

Summarize the function in one line.

Several sentences providing an extended description. Refer to variables using back-ticks, e.g. var.

Parameters:
var1array_like

Array_like means all those objects – lists, nested lists, etc. – that can be converted to an array. We can also refer to variables like var1.

var2int

The type above can either refer to an actual Python type (e.g. int), or describe the type of the variable in more detail, e.g. (N,) ndarray or array_like.

*argsiterable

Other arguments.

long_var_name{‘hi’, ‘ho’}, optional

Choices in brackets, default first when optional.

**kwargsdict

Keyword arguments.

Returns:
type

Explanation of anonymous return value of type type.

describetype

Explanation of return value named describe.

outtype

Explanation of out.

type_without_description
Other Parameters:
only_seldom_used_keywordstype

Explanation.

common_parameters_listed_abovetype

Explanation.

Raises:
BadException

Because you shouldn’t have done that.

See also

numpy.array

Relationship (optional).

numpy.ndarray

Relationship (optional), which could be fairly long, in which case the line wraps here.

numpy.dot, numpy.linalg.norm, numpy.eye

Notes

Notes about the implementation algorithm (if needed).

This can have multiple paragraphs.

You may include some math:

\[X(e^{j\omega } ) = x(n)e^{ - j\omega n}\]

And even use a Greek symbol like \(\omega\) inline.

References

Cite the relevant literature, e.g. [1]. You may also cite these references in the notes section above.

[1]

O. McNoleg, “The integration of GIS, remote sensing, expert systems and adaptive co-kriging for environmental habitat modelling of the Highland Haggis using object-oriented, fuzzy-logic and neural-network techniques,” Computers & Geosciences, vol. 22, pp. 585-588, 1996.

Examples

These are written in doctest format, and should illustrate how to use the function.

>>> a = [1, 2, 3]
>>> print([x + 3 for x in a])
[4, 5, 6]
>>> print("a\nb")
a
b