Skip to content

Commit

Permalink
fix-rtd-formatting (#257)
Browse files Browse the repository at this point in the history
fixes failed rendering on rtd for matlab and python

Updates to the build system on readthedocs.org, changes to sphinx-contrib
for matlab, and now explicitly copying over some metadata (on this author)
so that it's available on the read the docs vm during build.

* refactoring and small formatting changes to docs
* update rtd yaml and conf.py
* copy over metadata to pypet2bids/pypet2bids folder
* update sphinx-contrib version to 0.21.4
  • Loading branch information
bendhouseart authored Jan 18, 2024
1 parent 1c6928f commit d4da7f3
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 98 deletions.
17 changes: 6 additions & 11 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,22 @@ submodules:

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.11"
jobs:
post_create_environment:
- cp -r metadata pypet2bids/pypet2bids/
# install poetry
# https://python-poetry.org/docs/#osx--linux--bashonwindows-install-instructions
- curl -sSL https://install.python-poetry.org | python3 -
# Tell poetry to not use a virtual environment
- $HOME/.local/bin/poetry config virtualenvs.create false
- pip install poetry
- poetry config virtualenvs.create false
# just use poetry to export a requirements.txt as that worked much better than the previous attempts
- cd pypet2bids && $HOME/.local/bin/poetry export --with dev --without-hashes -o requirements.txt
- cd pypet2bids && poetry lock && poetry export --without-hashes --with dev --format=requirements.txt > requirements.txt

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ installpackage:

testphantoms:
@scripts/testphantoms

html:
@cd docs && make html
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Welcome to PET2BIDS's documentation!
installation
usage
modules
matlab
spreadsheets
:maxdepth: 2
:caption: Contents:
Expand Down
10 changes: 5 additions & 5 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ If you wish to contribute, are unable to install from PyPi, or simply wish to ru
reading the `Additional Install Notes`_ section below.

Additional Install Notes
========================
------------------------

Matlab
------
**Matlab**

------------------------------------------------------------------------------------------------------------------------

**Dependencies**

Expand Down Expand Up @@ -76,8 +77,7 @@ all arguments in although this is also possible). You can find templates of such

------------------------------------------------------------------------------------------------------------------------

Python
------
**Python**

If you are unable to install this library from PyPi you can clone this repository to build and install the package
as distributed on PyPi yourself with poetry.
Expand Down
2 changes: 1 addition & 1 deletion docs/matlab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ matlab
.. mat:autofunction:: dcm2niix4pet
.. mat:autofunction:: updatjsonpetfile
.. mat:autofunction:: updatejsonpetfile
.. mat:autofunction:: ecat2nii
Expand Down
5 changes: 3 additions & 2 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
pypet2bids
==========
Code
====

.. toctree::
:maxdepth: 4

pypet2bids
matlab
7 changes: 2 additions & 5 deletions docs/pypet2bids.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
.. _pypet2bids-package:

pypet2bids package
==================

Submodules
----------
pypet2bids
==========

pypet2bids.ecat\_cli module
---------------------------
Expand Down
9 changes: 4 additions & 5 deletions matlab/get_pet_metadata.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
function metadata = get_pet_metadata(varargin)

% Routine that outputs PET scanner metadata following
% `BIDS <https://bids.neuroimaging.io/ BIDS>`_.
%
Expand All @@ -16,16 +15,16 @@
% all info is necessarily needed\)
% :param inputs: a series of key/value pairs are expected
% :returns metadata: a structure with BIDS fields filled \(such structure is ready
% to be writen as json file using e.g. the bids matlab jsonwrite
% function, typically associated with the *_pet.nii file\)
% to be writen as json file using e.g. the bids matlab jsonwrite
% function, typically associated with the \*_pet.nii file\)
%
% :format: metadata = get_pet_metadata(key,value)
%
% .. note::
%
% Mandatory inputs are as follows\:
%
% - *Scanner* name of scanner, map to a *parameters.txt file e.g. 'Scanner', 'SiemensBiograph'
% - *Scanner* name of scanner, map to a \*parameters.txt file e.g. 'Scanner', 'SiemensBiograph'
% - *TimeZero* when was the tracer injected e.g. 'TimeZero','11:05:01'
% - *ModeOfAdministration* e.g. 'ModeOfAdministration', 'bolus'
% - *TracerName* which tracer was used e.g. 'TracerName','DASB'
Expand Down Expand Up @@ -55,7 +54,7 @@
% FrameTimesStart = 0;
%
% .. note::
% TimeZero also can be [] or 'ScanStart' indicating that the scanning time
% TimeZero also can be [] or 'ScanStart' indicating that the scanning time
% should be used as TimeZero. If TimeZero is not the scan time, we strongly
% advice to input ScanStart and InjectionStart making sure timing is correct
%
Expand Down
102 changes: 43 additions & 59 deletions pypet2bids/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pypet2bids/pypet2bids/dcm2niix4pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from tempfile import TemporaryDirectory
import shutil
from dateutil import parser
from termcolor import colored
import argparse
import importlib
import dotenv
Expand Down
Loading

0 comments on commit d4da7f3

Please sign in to comment.