Python script to automate the plotting and analysis of percentage depth dose and dose profile simulations in TOPAS.

Overview

topas-create-graphs

A script to automatically plot the results of a topas simulation

Works for percentage depth dose (pdd) and dose profiles (dp). Depth dose measurements are assumed to
be in the z-direction, dose profiles in the x- or y-directions.

Automatically calculates relevant parameters

Measurement type Parameters
Depth dose Q-Factor zmax
Dose profile FWHM CAXdev FLATKrieger FLATstddev Penumbra (L&R) Integral (L&R)
  • Q-Factor : Radiation Quality Factor

  • zmax : Depth at Maximum

  • FWHM : Full-Width at Half-Maximum

  • CAXdev : Centre Axis Deviation

  • FLATKrieger : Flatness of Dose Plateau (Definitionby Krieger)

  • FLATstddev : Flatness of Dose Plateau (Standard Deviation)

  • Penumbra (L&R) : Width of Left and Right Penumbra

  • Integral (L&R) : Integral below Left and Right Penumbra

Includes an optional GUI

The script is intended as a command line tool, where the first argument is the path to the file, and the second is the number of histories. However, the GUI can also be used. It comes with basic file selection and preview of the graph, as well as the option to save the graph.

Assumes a ".csv" input file format from a TOPAS Scorer with the following header format:

# TOPAS Version: {...}
# Parameter File: {...}.txt
# Results for scorer {...}
# Scored in component: {...}
# X in {...} bin of {...} cm
# Y in 1 {...} of {...} cm
# Z in {...} bins of {...} cm
# DoseToMedium ( Gy ) : {Sum/Mean} Standard_Deviation
Voxel Coordinate X, Voxel Coordinate Y, Voxel Coordinate Z, {Sum/Mean} Value, Standard_Deviation Value
.
.
.

Dependencies

Uses the beautiful Azure-ttk dark theme by @rdbende. Requires Python3 and Numpy, Scipy, Matplotlib, Pillow and cv2.

You might also like...
A set of functions and analysis classes for solvation structure analysis

SolvationAnalysis The macroscopic behavior of a liquid is determined by its microscopic structure. For ionic systems, like batteries and many enzymes,

 🧪 Panel-Chemistry - exploratory data analysis and build powerful data and viz tools within the domain of Chemistry using Python and HoloViz Panel.
🧪 Panel-Chemistry - exploratory data analysis and build powerful data and viz tools within the domain of Chemistry using Python and HoloViz Panel.

🧪📈 🐍. The purpose of the panel-chemistry project is to make it really easy for you to do DATA ANALYSIS and build powerful DATA AND VIZ APPLICATIONS within the domain of Chemistry using using Python and HoloViz Panel.

Larch: Applications and Python Library for Data Analysis of X-ray Absorption Spectroscopy (XAS, XANES, XAFS, EXAFS), X-ray Fluorescence (XRF) Spectroscopy and Imaging

Larch: Data Analysis Tools for X-ray Spectroscopy and More Documentation: http://xraypy.github.io/xraylarch Code: http://github.com/xraypy/xraylarch L

Sensitivity Analysis Library in Python (Numpy). Contains Sobol, Morris, Fractional Factorial and FAST methods.

Sensitivity Analysis Library (SALib) Python implementations of commonly used sensitivity analysis methods. Useful in systems modeling to calculate the

 A data analysis using python and pandas to showcase trends in school performance.
A data analysis using python and pandas to showcase trends in school performance.

A data analysis using python and pandas to showcase trends in school performance. A data analysis to showcase trends in school performance using Panda

A collection of learning outcomes data analysis using Python and SQL, from DQLab.
A collection of learning outcomes data analysis using Python and SQL, from DQLab.

Data Analyst with PYTHON Data Analyst berperan dalam menghasilkan analisa data serta mempresentasikan insight untuk membantu proses pengambilan keputu

BioMASS - A Python Framework for Modeling and Analysis of Signaling Systems
BioMASS - A Python Framework for Modeling and Analysis of Signaling Systems

Mathematical modeling is a powerful method for the analysis of complex biological systems. Although there are many researches devoted on produ

Weather analysis with Python, SQLite, SQLAlchemy, and Flask
Weather analysis with Python, SQLite, SQLAlchemy, and Flask

Surf's Up Weather analysis with Python, SQLite, SQLAlchemy, and Flask Overview The purpose of this analysis was to examine weather trends (precipitati

Stock Analysis dashboard Using Streamlit and Python
Stock Analysis dashboard Using Streamlit and Python

StDashApp Stock Analysis Dashboard Using Streamlit and Python If you found the content useful and want to support my work, you can buy me a coffee! Th

Comments
  • Nice work! plus a few comments

    Nice work! plus a few comments

    Firstly, this is really nice! i have been vaguely contemplating if I should do something like this given the number of how 'how do I plot...' questions on the forums. Nice to see. The following are some comments/questions/suggestions. Feel free to ignore any that aren't helpful!

    comments

    • I would move the install instructions closer to the top of the read me, because whenever I look at software on github the first thing I want to do is make sure I can install it before I start read the detailed instructions.

    questions

    • what scoring geometries does this handle? or will it handle anything? e.g. I think depending on the scoring component, the coordinates might be polar or cartesian (right?), will this handle both?
    • Is it possible to run this 'headless' (no GUI?) and if not would it be difficult to add this? In many situations it would be nice to be able to script analysis...also for debugging this would be handy.

    install experience

    • In ubuntu, I had to do sudo apt install python3.9-dev before this package would install. It was some issue with a package called evdev
    • In windows worked perfectly.

    use experience

    • in linux the default window is very large - I can make it larger, but I can't make it smaller. weird!
    • I tried to load some .bin files from a TsBox scorer; in windows and linux I got the error "AttributeError: 'Simulation' object has no attribute 'direction'"
    • In general it looks like there are a few if, elif statements where it would be a good idea to put a final else: raise NotImplementedError
    opened by bwheelz36 6
  • Fix Y-Axis Label

    Fix Y-Axis Label

    3ddose dataset shows y-axis label "mm" if not normalized. --> "Dose [Gy/history]" Maybe add optionial or permanent label for relative dose distributions e.g. "Relative Dosis"

    opened by jaschst 1
  • Add Gamma Index Calculation

    Add Gamma Index Calculation

    import pymedphys

    gamma = pymedphys.gamma( (data[0][0],), data[0][1], (data[1][0],), data[1][1], 1, 1 )

    valid_gamma = gamma[~np.isnan(gamma)] pass_ratio = np.sum(valid_gamma <= 1) / len(valid_gamma) print(pass_ratio)

    enhancement 
    opened by sebasj13 0
Releases(v21.1.2)
  • v21.1.2(Jun 23, 2022)

    What's Changed

    • Bug fix preventing simulations without a standard deviation from loading

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v21.1.1...v21.1.2

    Source code(tar.gz)
    Source code(zip)
  • v21.1.1(Jun 20, 2022)

    What's Changed

    • Saving now includes the parameter table

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v21.1.0...v21.1.1

    Source code(tar.gz)
    Source code(zip)
  • v21.1.0(Jun 20, 2022)

    What's Changed

    • Added option to add a title to the graph
    • Added option to rename the Y-axis
    • Minor bug fixes when importing custom measurements

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v21.0.0...v21.1.0

    Source code(tar.gz)
    Source code(zip)
  • v21.0.0(Jun 13, 2022)

    What's Changed

    • Added the option to show the value of the plot on mouse hover under: Menu -> View -> Show value on hover
    • Major overhaul on the menu bar - it should be more responsive and intuitive to use!
    • Fixed a bug which prevented renaming of the X-axis
    • Bug fixes and performance improvements

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v20.1.1...v21.0.0

    Source code(tar.gz)
    Source code(zip)
  • v20.1.1(May 31, 2022)

    What's Changed

    • Minor bug fixes in the handling of RadCalc files

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v20.1.0...v20.1.1

    Source code(tar.gz)
    Source code(zip)
  • v20.1.0(May 12, 2022)

  • v20.0.6(Apr 8, 2022)

    What's Changed

    • Fix case sensitivity in PTW measurement import by @sebasj13 in https://github.com/sebasj13/TopasGraphSim/pull/82

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v20.0.4...v20.0.5

    Source code(tar.gz)
    Source code(zip)
  • v20.0.4(Mar 26, 2022)

    What's Changed

    • Prompt the select the type of measurment when importing custom formats

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v20.0.3...v20.0.4

    Source code(tar.gz)
    Source code(zip)
  • v20.0.3(Mar 25, 2022)

    What's Changed

    • Added extra check for the lower dose cutoff in gamma calculations

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v20.0.2...v20.0.3

    Source code(tar.gz)
    Source code(zip)
  • v20.0.2(Mar 24, 2022)

    What's Changed

    • Open file dialog now defualts to the most recently used directory instead of the install location

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v20.0.1...v20.0.2

    Source code(tar.gz)
    Source code(zip)
  • v20.0.1(Mar 24, 2022)

  • v20.0.0(Mar 16, 2022)

    What's Changed

    • Added gamma index calculation by @sebasj13 in https://github.com/sebasj13/TopasGraphSim/pull/80

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v19.1.1...v20.0.0

    Source code(tar.gz)
    Source code(zip)
  • v19.1.1(Feb 22, 2022)

    What's Changed

    • Bug fixes and performance improvements

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v19.1.0...v19.1.1

    Source code(tar.gz)
    Source code(zip)
  • v19.1.0(Feb 22, 2022)

    What's Changed

    • Quality of life updates to the zoom window
    • Bug fixes and performance improvements

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v19.0.3...v19.1.0

    Source code(tar.gz)
    Source code(zip)
  • v19.0.3(Feb 21, 2022)

    What's Changed

    • Big fixes and performance improvements

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v19.0.2...v19.0.3

    Source code(tar.gz)
    Source code(zip)
  • v19.0.2(Feb 21, 2022)

    What's Changed

    • Added plateau normalization option, which averages the 10 central points
    • Bug fixes and performance improvements

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v19.0.0...v19.0.2

    Source code(tar.gz)
    Source code(zip)
  • v19.0.0(Feb 20, 2022)

    What's Changed

    • Fixed parameter calculation for custom measurement files
    • Added customization of the graph markers https://github.com/sebasj13/TopasGraphSim/pull/76
    • Added a citation https://github.com/sebasj13/TopasGraphSim/pull/78
    • Bug fixes and performance improvements

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v18.2.1...v19.0.0

    Source code(tar.gz)
    Source code(zip)
  • v18.2.1(Feb 19, 2022)

    What's Changed

    • Fixed a bug that prevented app startup when a recent file had been moved/deleted

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v18.2.0...v18.2.1

    Source code(tar.gz)
    Source code(zip)
  • v18.2.0(Feb 17, 2022)

    What's Changed

    • Added recent files functionality and improved the performance of the PTW Importer by @sebasj13 in https://github.com/sebasj13/TopasGraphSim/pull/73

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v18.1.2...v18.2.0

    Source code(tar.gz)
    Source code(zip)
  • v18.1.2(Feb 17, 2022)

    What's Changed

    • The Application now opens where it was last closed

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v18.1.1...v18.1.2

    Source code(tar.gz)
    Source code(zip)
  • v18.1.1(Feb 16, 2022)

  • v18.1.0(Feb 16, 2022)

    What's Changed

    • Major Performance improvements and stability updates when resizing the window or scrubbing though the data

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v18.0.2...v18.1.0

    Source code(tar.gz)
    Source code(zip)
  • v18.0.2(Feb 14, 2022)

    What's Changed

    • Removed half screen height restriction to allow for better tiling in Windows

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v18.0.0...v18.0.2

    Source code(tar.gz)
    Source code(zip)
  • v17.3.1(Feb 12, 2022)

  • v17.3.0(Feb 12, 2022)

    What's Changed

    • Added drag and drop support
    • Improved the y-axis labels

    Know issue:

    • When switching the language, existing graphs aren't placed correctly. A workaround is switching the theme, then switching back.

    Full Changelog: https://github.com/sebasj13/TopasGraphSim/compare/v17.2.9...v17.3.0

    Source code(tar.gz)
    Source code(zip)
  • v17.2.9(Feb 10, 2022)

    What's Changed

    • Overhaul to the placement of elements on screen
    • Bug fixes and performance improvements

    Full Changelog: https://github.com/sebasj13/topasgraphsim/compare/v17.2.8...v17.2.9

    Source code(tar.gz)
    Source code(zip)
  • v17.2.8(Feb 7, 2022)

    What's Changed

    • Important Bug fix - assignment of errorbars to data was flipped and is now fixed

    Full Changelog: https://github.com/sebasj13/topasgraphsim/compare/v17.2.7...v17.2.8

    Source code(tar.gz)
    Source code(zip)
  • v17.2.7(Feb 7, 2022)

  • v17.2.6(Feb 6, 2022)

  • v17.2.5(Feb 6, 2022)

    What's Changed

    • Fixed a bugged color when using dark mode

    Full Changelog: https://github.com/sebasj13/topasgraphsim/compare/v17.2.4...v17.2.5

    Source code(tar.gz)
    Source code(zip)
Owner
Sebastian Schäfer
Master Student of medical physics and Python enthusiast.
Sebastian Schäfer
MDAnalysis is a Python library to analyze molecular dynamics simulations.

MDAnalysis Repository README [*] MDAnalysis is a Python library for the analysis of computer simulations of many-body systems at the molecular scale,

MDAnalysis 933 Dec 28, 2022
Repository created with LinkedIn profile analysis project done

EN/en Repository created with LinkedIn profile analysis project done. The datase

Mayara Canaver 4 Aug 6, 2022
Helper tools to construct probability distributions built from expert elicited data for use in monte carlo simulations.

Elicited Helper tools to construct probability distributions built from expert elicited data for use in monte carlo simulations. Credit to Brett Hoove

Ryan McGeehan 3 Nov 4, 2022
First and foremost, we want dbt documentation to retain a DRY principle. Every time we repeat ourselves, we waste our time. Second, we want to understand column level lineage and automate impact analysis.

dbt-osmosis First and foremost, we want dbt documentation to retain a DRY principle. Every time we repeat ourselves, we waste our time. Second, we wan

Alexander Butler 150 Jan 6, 2023
This is an example of how to automate Ridit Analysis for a dataset with large amount of questions and many item attributes

This is an example of how to automate Ridit Analysis for a dataset with large amount of questions and many item attributes

Ishan Hegde 1 Nov 17, 2021
A Python 3 library making time series data mining tasks, utilizing matrix profile algorithms

MatrixProfile MatrixProfile is a Python 3 library, brought to you by the Matrix Profile Foundation, for mining time series data. The Matrix Profile is

Matrix Profile Foundation 302 Dec 29, 2022
Leverage Twitter API v2 to analyze tweet metrics such as impressions and profile clicks over time.

Tweetmetric Tweetmetric allows you to track various metrics on your most recent tweets, such as impressions, retweets and clicks on your profile. The

Mathis HAMMEL 29 Oct 18, 2022
In this tutorial, raster models of soil depth and soil water holding capacity for the United States will be sampled at random geographic coordinates within the state of Colorado.

Raster_Sampling_Demo (Resulting graph of this demo) Background Sampling values of a raster at specific geographic coordinates can be done with a numbe

null 2 Dec 13, 2022
Demonstrate the breadth and depth of your data science skills by earning all of the Databricks Data Scientist credentials

Data Scientist Learning Plan Demonstrate the breadth and depth of your data science skills by earning all of the Databricks Data Scientist credentials

Trung-Duy Nguyen 27 Nov 1, 2022
Statistical Analysis 📈 focused on statistical analysis and exploration used on various data sets for personal and professional projects.

Statistical Analysis ?? This repository focuses on statistical analysis and the exploration used on various data sets for personal and professional pr

Andy Pham 1 Sep 3, 2022