Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚗️ A C/C++ backend for priwo. #17

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
Language: Cpp
AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
46 changes: 0 additions & 46 deletions .github/workflows/release.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/test.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/build
.clangd
.clang_format

dist
build
.egg
Expand Down
13 changes: 0 additions & 13 deletions .readthedocs.yaml

This file was deleted.

74 changes: 74 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Set the minimum CMake version and policies for highest tested version
cmake_minimum_required(VERSION 3.15...3.27)

# Set up the project and ensure there is a working C++ compiler
project(priwo LANGUAGES CXX)

# Warn if the user invokes CMake directly
if (NOT SKBUILD)
message(WARNING "\
This CMake file is meant to be executed using 'scikit-build-core'.
Running it directly will almost certainly not produce the desired
result. If you are a user trying to install this package, use the
command below, which will install all necessary build dependencies,
compile the package in an isolated environment, and then install it.
=====================================================================
$ pip install .
=====================================================================
If you are a software developer, and this is your own package, then
it is usually much more efficient to install the build dependencies
in your environment once and use the following command that avoids
a costly creation of a new virtual environment at every compilation:
=====================================================================
$ pip install nanobind scikit-build-core[pyproject]
$ pip install --no-build-isolation -ve .
=====================================================================
You may optionally add -Ceditable.rebuild=true to auto-rebuild when
the package is imported. Otherwise, you need to rerun the above
after editing C++ files.")
endif()

# Try to import all Python components potentially needed by nanobind
find_package(Python 3.8
REQUIRED COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)

# Import nanobind through CMake's find_package mechanism
find_package(nanobind CONFIG REQUIRED)

# Add the module
nanobind_add_module(
_internals
STABLE_ABI
src/priwo/bits.h
src/priwo/bits.C
src/priwo/priwo.h
src/priwo/priwo.C
src/priwo/common.h
src/priwo/common.C

src/priwo/hdr.h
src/priwo/hdr.C
src/priwo/fil.h
src/priwo/fil.C
src/priwo/tim.h
src/priwo/tim.C

src/priwo/inf.h
src/priwo/inf.C
src/priwo/dat.h
src/priwo/dat.C
src/priwo/fft.h
src/priwo/fft.C
src/priwo/pfd.h
src/priwo/pfd.C
src/priwo/bestprof.h
src/priwo/bestprof.C


src/priwo/polycos.h
src/priwo/polycos.C
)

# Install directive for scikit-build-core
install(TARGETS _internals LIBRARY DESTINATION priwo)
Empty file removed CONTRIBUTING.md
Empty file.
25 changes: 0 additions & 25 deletions Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
MIT License

Copyright (c) 2021-2023 Ujjwal Panda <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

109 changes: 0 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,109 +0,0 @@
<div style="font-family:JetBrainsMono Nerd Font">
<div align="center">
<img
alt="priwo: I/O for common pulsar data formats."
src=https://raw.githubusercontent.com/astrogewgaw/logos/main/rasters/priwo.png
/>
</div>
<br/>

![License][license-badge]
![Version][version-badge]
![Python versions][pyversions-badge]

![Tests][tests-badge]
[![Documentation Status][docs-badge]][docs]
[![Interrogate][interrogate-badge]][interrogate]

![Stars][stars-badge]
![Downloads][dm-badge]
[![Issues][issues-badge]][issues]

[![Gitmoji][gitmoji-badge]][gitmoji]
[![Code style: black][black-badge]][black]

<div align="justify">

<h2>What is this?</h2>

[**`priwo`**][priwo] is a library that allows you to read in and write out
pulsar data from the following data formats:

- [**`SIGPROC`**][sigproc] headers,
- [**`PRESTO`**][presto] FFT (`*.fft`) files,
- [**`PRESTO`**][presto] infodata (`*.inf`) files,
- [**`PRESTO`**][presto] folded data (`*.pfd`) files,
- [**`PRESTO`**][presto] time series (`*.dat`) files,
- [**`SIGPROC`**][sigproc] filterbank (`*.fil`) files,
- [**`SIGPROC`**][sigproc] time series (`*.tim`) files,
- [**`PRESTO`**][presto] best pulse profile (`*.bestprof`) files,
- [**`TEMPO`**][tempo] polynomial ephemerides (`*.polycos`) files.

`priwo`'s API is deliberately _low-level_: each function in `priwo` deals with a
single file format and takes/returns a Python dictionary. This allows users to
design arbitrary high-level APIs on top of `priwo`'s functionality. This is
unlike most other contemporary libraries, such as [**`your`**][your]. `your` (to
which this library has been frequently compared to) provides a high-level API
for reading in pulsar data, while also providing modules to help process and
analyze it. This is makes the number of dependencies it uses is a bit high (as
of 05/10/22, that is a total of 9 dependencies). On the other hand, `priwo` has
just a single dependency: [**`pabo`**][pabo][^1]. This makes
it an ideal choice to drop into your projects, without worrying about
[**dependency hell**][dependency_hell].

`priwo` is well-tested (via [**`ward`**][ward]) and actively maintained. No
major changes to the API are expected before `v0.1.0`. Support for many more
formats, such as [`PSRFITS`][psrfits], is on the way. If you would like to
contribute, have a look at [`CONTRIBUTING.md`](CONTRIBUTING.md), and get in
touch! If you find a bug, feel free to open an [issue][issues]. If you would
like to suggest support for any data format(s) I have missed, suggest a feature,
or just chat, feel free to jump into the [discussions][discussions].

<h2>Installing</h2>

Installing `priwo` is as easy as:

```bash
pip install priwo
```

<br/>

[^1]:
[**`pabo`**][pabo] is a package I made to make parsing binary data easier,
and it has just two dependencies : [**`attrs`**][attrs] and
[**`numpy`**][numpy].

</div>

[numpy]: https://numpy.org
[attrs]: https://www.attrs.org
[gitmoji]: https://gitmoji.dev
[black]: https://github.com/psf/black
[just]: https://github.com/casey/just
[tempo]: https://tempo.sourceforge.net
[sigproc]: http://sigproc.sourceforge.net
[pabo]: https://github.com/astrogewgaw/pabo
[ward]: https://github.com/darrenburns/ward
[priwo]: https://github.com/astrogewgaw/priwo
[docs]: https://priwo.readthedocs.io/en/latest
[presto]: https://github.com/scottransom/presto
[your]: https://github.com/thepetabyteproject/your
[issues]: https://github.com/astrogewgaw/priwo/issues
[interrogate]: https://github.com/econchick/interrogate
[discussions]: https://github.com/astrogewgaw/priwo/discussions
[dependency_hell]: https://en.wikipedia.org/wiki/Dependency_hell
[psrfits]: https://www.atnf.csiro.au/research/pulsar/psrfits_definition/Psrfits.html
[dm-badge]: https://img.shields.io/pypi/dm/priwo?style=for-the-badge
[version-badge]: https://img.shields.io/pypi/v/priwo?style=for-the-badge
[wheel-badge]: https://img.shields.io/pypi/wheel/priwo?style=for-the-badge
[forks-badge]: https://img.shields.io/github/forks/astrogewgaw/priwo?style=for-the-badge
[stars-badge]: https://img.shields.io/github/stars/astrogewgaw/priwo?style=for-the-badge
[pyversions-badge]: https://img.shields.io/pypi/pyversions/priwo.svg?style=for-the-badge
[issues-badge]: https://img.shields.io/github/issues/astrogewgaw/priwo?style=for-the-badge
[license-badge]: https://img.shields.io/github/license/astrogewgaw/priwo?style=for-the-badge
[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge
[docs-badge]: https://readthedocs.org/projects/priwo/badge/?version=latest&style=for-the-badge
[gitmoji-badge]: https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=for-the-badge
[interrogate-badge]: https://raw.githubusercontent.com/astrogewgaw/priwo/main/assets/docs_cov.svg
[tests-badge]: https://img.shields.io/github/actions/workflow/status/astrogewgaw/priwo/test.yml?branch=dev&style=for-the-badge
28 changes: 0 additions & 28 deletions assets/docs_cov.svg

This file was deleted.

12 changes: 0 additions & 12 deletions docs/Makefile

This file was deleted.

Loading