Skip to content

Commit c4c738b

Browse files
update to PETSIRD 0.7.2 and remove python
1 parent 948c950 commit c4c738b

9 files changed

Lines changed: 70 additions & 45 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ RUN mkdir -p /home/vscode/.local/share/CMakeTools \
8787
&& chown vscode:conda /home/vscode/.local/share/CMakeTools/cmake-tools-kits.json
8888

8989
# Install the yardl tool
90-
ARG YARDL_VERSION=0.6.2
90+
ARG YARDL_VERSION=0.6.3
9191
RUN wget --quiet "https://github.com/microsoft/yardl/releases/download/v${YARDL_VERSION}/yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" \
9292
&& tar -xzf "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" \
9393
&& mv yardl "/opt/conda/envs/${CONDA_ENVIRONMENT_NAME}/bin/" \

PETSIRD

Submodule PETSIRD updated 57 files

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# PETSIRD template for use cases
1+
# PETSIRD template for C++ use cases
22

33
The purpose of this repo is to provide a starting point for developing software that uses PETSIRD.
4-
It is currently mostly needed/useful for C++ development, but is also useful for Python developers
5-
who want to experiment with development of PETSIRD itself.
4+
It is currently mostly needed/useful for C++ development.
65

76
## Background
87
The [Emission Tomography Standardization Initiative (ETSI)](https://etsinitiative.org/)
@@ -18,7 +17,14 @@ These instructions will use `YourRepoName` for the name of your new repository.
1817
Easiest is to start from GitHub:
1918
1. Navigate to the URL of this repo: https://github.com/ETSInitiative/PETSIRDUseCaseTemplate
2019
2. Click on the `Use this template` button and create your own repo
21-
3. Pull it to your own local machine and modify
20+
21+
### Using your repo
22+
23+
1. Open ***your*** repo in [GitHub Codespaces](https://code.visualstudio.com/docs/remote/codespaces) or
24+
in a [VS Code devcontainer](https://code.visualstudio.com/docs/devcontainers/containers).
25+
This codespace/container will contain all necessary tools, including `yardl` itself, as well as your repository.<br>
26+
(Alternatively, clone to your local computer with `git clone --recurse-submodules <repository_url>`, download `yardl`, install dependencies etc.)
27+
2. Start with basic house-keeping
2228
1. Search-and-replace all occurences of `PETSIRDUseCaseTemplate` with `YourRepoName`
2329
2. Update the README.md to remove references to this template and write something about what your repo is going to do
2430
3. Update the `environment.yml`to include what you need. For instance, if you need ROOT, add something like `- root=6.28.0`
@@ -27,19 +33,17 @@ Easiest is to start from GitHub:
2733
git commit -a -m "Updated template to YourRepoName"
2834
git push
2935
```
30-
31-
### Using your repo
32-
33-
1. Open ***your*** repo in [GitHub Codespaces](https://code.visualstudio.com/docs/remote/codespaces) or
34-
in a [VS Code devcontainer](https://code.visualstudio.com/docs/devcontainers/containers).
35-
This codespace/container will contain all necessary tools, including `yardl` itself, as well as your repository.
36-
2. Use `yardl` to generate C++ and Python code for the model:
37-
```sh
38-
cd YourRepoName
39-
cd PETSIRD/model
40-
yardl generate
41-
cd ../..
42-
```
43-
3. Start working in either the [`cpp`](cpp/README.md) and/or [`python`](python/README.md) directories.
36+
3. Start working in the [`cpp`](cpp/README.md) directory.
37+
4. Edit the [`justfile`](justfile), e.g. to add a `@run` target
38+
5. type `just build` (or `just run`)
39+
40+
Note: if you don't want to use `just`, you will have to use `yardl` to generate C++ and Python
41+
code for the model:
42+
```sh
43+
cd YourRepoName
44+
cd PETSIRD/model
45+
yardl generate
46+
cd ../..
47+
```
4448
4549

cpp/CMakeLists.txt

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
11
cmake_minimum_required(VERSION 3.12.0) # older would work, but could give warnings on policy CMP0074
2-
project(PETSIRDUseCaseTemplate VERSION 0.2.0)
2+
project(PETSIRDUseCaseTemplate VERSION 0.7.2)
33

44
set(CMAKE_CXX_STANDARD 17)
55

6+
#Set the build type to Release if not specified
7+
if (NOT CMAKE_BUILD_TYPE)
8+
set(CMAKE_BUILD_TYPE Release CACHE STRING
9+
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
10+
FORCE)
11+
endif ()
12+
613
if(WIN32)
714
add_compile_options(/W3 /WX)
815
else()
916
add_compile_options(-Wall -Wextra -pedantic)
1017
endif()
1118

19+
set(PETSIRD_dir ../PETSIRD/cpp/generated)
20+
add_subdirectory(${PETSIRD_dir} PETSIRD_generated)
21+
22+
# Add any packages, below is an example for ROOT (unlikely you'll need that one though!)
23+
# find_package(ROOT REQUIRED COMPONENTS Tree)
24+
1225
# Example lines for a new executable
1326
# add_executable(my_prog my_prog.cpp)
27+
# target_include_directories(my_prog PUBLIC ${PETSIRD_dir})
28+
# needed for helpers
29+
# target_include_directories(my_prog PUBLIC ${PETSIRD_dir}/..)
30+
# target_include_directories(my_prog PUBLIC ${PETSIRD_dir}/../helpers/include)
1431
# target_link_libraries(my_prog PUBLIC petsird_generated)
15-
# install(TARGETS my_prog DESTINATION bin)
1632

17-
add_subdirectory(../PETSIRD/cpp/generated PETSIRD_generated)
33+
# add any dependencies on packages here
34+
# target_link_libraries(my_prog PUBLIC ROOT::Tree)
35+
36+
# install(TARGETS my_prog DESTINATION bin)

cpp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This directory provides a skeleton for C++ example code to read/write PETSIRD data. You need to `yardl generate` in the `model` directory first.
44

5-
Check the example in the PRDdefinition repo first.
5+
Check the example in the PETSIRD repo first.
66

77
1. Compile the code:
88
```sh

environment.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ dependencies:
66
- bash-completion>=2.11
77
- cmake>=3.21.3
88
- fmt>=8.1.1
9-
- compilers
10-
- h5py>=3.7.0
9+
- cxx-compiler
1110
- hdf5>=1.12.1
1211
- howardhinnant_date>=3.0.1
13-
- ipykernel>=6.19.2
12+
- just=1.36.0
1413
- ninja>=1.11.0
1514
- nlohmann_json>=3.11.2
16-
- numpy>=1.24.3
17-
- python>=3.11.3
18-
- matplotlib
1915
- shellcheck>=0.8.0
20-
- xtensor-fftw>=0.2.5
21-
- xtensor>=0.24.2
16+
- xtensor>=0.24.2, <0.26.0
17+
- xtensor-blas

justfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
set shell := ['bash', '-ceuo', 'pipefail']
2+
3+
default: run
4+
5+
@ensure-build-dir:
6+
mkdir -p cpp/build
7+
8+
@generate:
9+
cd PETSIRD/model; \
10+
yardl generate
11+
12+
@configure: generate ensure-build-dir
13+
cd cpp/build; \
14+
cmake -GNinja ..
15+
16+
@build: generate configure
17+
cd cpp/build; \
18+
ninja
19+

python/README.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

python/start.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)