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

fix GSM methods for python wrapper #198

Merged
merged 9 commits into from
Oct 3, 2022
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../ -DCMAKE_INSTALL_PREFIX=$HOME/usr
cmake --build . --target install -- -j2
cmake --build . --target install -- -j

- name: tests
run: |
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
tar -xzf gsl-latest.tar.gz -C $HOME/gsl-latest
mv $HOME/gsl-latest/** $HOME/gsl-latest/gsl
mkdir $HOME/usr
cd $HOME/gsl-latest/gsl/ && emconfigure ./configure --prefix=$HOME/usr --disable-shared && emmake make -j2 && emmake make install
cd $HOME/gsl-latest/gsl/ && emconfigure ./configure --prefix=$HOME/usr --disable-shared && emmake make -j && emmake make install
ls -al $HOME/usr/lib/

- name: Compile libamtrack webassembly package
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![Build Status](https://travis-ci.org/libamtrack/library.svg?branch=master)](https://travis-ci.org/libamtrack/library)

# 1. WHAT IS LIBAMTRACK?

* libamtrack provides computational routines for the prediction of detector response and radiobiological efficiency in heavy charged particle beams.
Expand All @@ -11,8 +9,6 @@
* libamtrack is free, open-source software under GNU GPL licence.
* libamtrack is intended to facilitate the comparison of and the communication on amorphous track models for particle beam research.

libamtrack's main website: http://libamtrack.dkfz.org


# 2. HOW CAN I USE LIBAMTRACK?

Expand Down Expand Up @@ -43,8 +39,6 @@ This should be the very last alternative - THE FACT THAT YOU ARE LOOKING AT THIS
Everybody is welcome to read, use and modify (preferably to improve) the code according to GNU GPL 3.



# 4. WHERE DO I FIND DOCUMENTATION ON LIBAMTRACK?

- The libamtrack manual is found here: /docs/libamtrackManual.pdf
- On the webpage: libamtrack.dkfz.org
- The libamtrack manual is found here: /docs/libamtrackManual.pdf
36 changes: 25 additions & 11 deletions distributions/Python/pyamtrack/make_wheel_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
# get the tool which aids making wheel package
# it will automatically generate python wrapper for decorated (doxygen) C code
rm -rf cBinder || exit 1
git clone https://github.com/Tetrite/cBinder.git || exit 1
if [ -d "$DIR" ]; then
echo "cBinder already exists"
cd cBinder || exit 1
git pull || exit 1
else
git clone https://github.com/Tetrite/cBinder.git || exit 1
fi

# copy source files and headers to local folder, so the docker container can access them
rm -rf libamtrack || exit 1
Expand All @@ -13,20 +19,28 @@ cp -rf ../../../include libamtrack/ || exit 1
cp -rf ../../../src libamtrack/ || exit 1

# get necessary dependency (latest) version of GSL library
rm -f gsl.tar.gz || exit 1
wget --quiet "http://ftpmirror.gnu.org/gnu/gsl/gsl-latest.tar.gz" --output-document=gsl.tar.gz || exit 1
if [ -d "gsl-latest" ]; then
echo "gsl-latest already exists"
else
rm -f gsl.tar.gz || exit 1
wget --quiet "http://ftpmirror.gnu.org/gnu/gsl/gsl-latest.tar.gz" --output-document=gsl.tar.gz || exit 1

# unpack into gsl-x.y directory
rm -rf gsl-?.* || exit 1
tar -zxf gsl.tar.gz || exit 1
# unpack into gsl-x.y directory
rm -rf gsl-?.* || exit 1
tar -zxf gsl.tar.gz || exit 1

# move into gsl-latest directory
rm -rf gsl-latest || exit 1
mv gsl-?.* gsl-latest || exit 1
fi

# move into gsl-latest directory
rm -rf gsl-latest || exit 1
mv gsl-?.* gsl-latest || exit 1

# make directory for GSL installation
rm -rf gsl || exit 1
mkdir gsl || exit 1
if [ -d "gsl" ]; then
echo "gsl already exists"
else
mkdir gsl || exit 1
fi

# run the docker process which using manylinux1 machine (SLC6 based) will compile
# the C extensions using old enough libraries
Expand Down
8 changes: 8 additions & 0 deletions example/demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@ add_executable (${PROJECT_NAME} ${SOURCE_FILES} )

target_link_libraries( ${PROJECT_NAME} LINK_PUBLIC amtrack ${GSL_LIBRARIES})

# Visual Studio does not need or want you to explicitly request linking the math library.
# You must avoid adding it as a link library when building for Windows.
# see https://stackoverflow.com/questions/54935559/linking-math-library-in-cmake-file-on-windows-and-linux
IF (NOT WIN32)
target_link_libraries (${PROJECT_NAME} m)
ENDIF()


install(TARGETS ${PROJECT_NAME} DESTINATION bin)
19 changes: 10 additions & 9 deletions include/AT_Algorithms_GSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,19 @@ void AT_run_GSM_method( const long number_of_field_components,
* @param[in] material_no index number for detector material
* @see AT_DataMaterial.h for definition
* @param[in] rdd_model index number for chosen radial dose distribution
* @param[in] rdd_parameter parameters for chosen radial dose distribution (array of size depending on chosen model)
* @param[in] rdd_parameter parameters for chosen radial dose distribution (array of size 3)
* @see AT_RDD.h for definition
* @param[in] er_model index number for chosen electron-range model
* @see AT_ElectronRange.h for definition
* @param[in] stopping_power_source_no TODO
* @param[in] nX TODO
* @param[in] pixel_size_m TODO
* @param[in] number_of_bins TODO
* @param[in] dose_bin_centers_Gy TODO
* @param[out] random_number_generator_seed TODO
* @param[out] zero_dose_fraction TODO
* @param[out] dose_frequency_Gy TODO
* @param[in] stopping_power_source_no stopping power source number (PSTAR,...)
* @see AT_DataMaterial.h for definition
* @param[in] nX number of pixels along one side
* @param[in] pixel_size_m pixel size [m]
* @param[in] number_of_bins number of bins in the histogram
* @param[in] dose_bin_centers_Gy edges in the output dose histogram (array of size number_of_bins)
* @param[out] random_number_generator_seed seed for the random number generator
* @param[out] zero_dose_fraction fraction of pixels with zero dose
* @param[out] dose_frequency_Gy values in the output dose histogram (array of size number_of_bins)
*/
void AT_GSM_local_dose_distrib( const long number_of_field_components,
const double E_MeV_u[],
Expand Down
6 changes: 5 additions & 1 deletion src/AT_Algorithms_GSM.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ void AT_GSM_local_dose_distrib_from_dose_grid( const long nX,
bin_no = AT_histoOld_bin_no( number_of_bins,
bin_centers_Gy,
grid[i][j]);
frequency[bin_no] += 1.0;
// user could provide bins not spanning whole dose range
// we skip the values outside the range
if((bin_no >= 0) && (bin_no < number_of_bins)){
frequency[bin_no] += 1.0;
}
}
}
}
Expand Down