Closed haeginh closed 10 months ago
Hi, This seems to be the same problem as I myself ran into just recently. It is due to a bug in the handling of the path to the SQLite database of corrections that is created the first time the program i run. As this error does not affect the development environment this was sadly not discovered sooner.
I'll try to add a fix for this as soon as possible. In the meantime you could check for the corrections.db
file in the installed PySkinDose package in your projects site-packages or download and unzip the version I've attached here.
corrections.zip
The corrections.db
file should be placed in the same directory as the file you're trying to run the PySkinDose-analysis in.
I'll update this issue when the fix has been added and an upgrade of the PySkinDose package-version can be done to fix the issue.
As for your other question. The correction factors are calculated for each skin patch so the dose assigned to each skin patch in a beam will have individual correction factor for, for example, the inverse-square law. This can be checked by running the analysis for an SR-file where there is only one irradiation event and hovering with the mouse over the dose map skin patches. Doing so should give you different dose values for the different skin patches depending on the placement in relation to the table, distance from the X-ray source etc.
Thank you for the quick reply. I could finally execute the code and it looks great. Do you have any documentation or example code so that I can modify it to calculate the dose for my own event settings?
We will have to add that to the documentation.
To get going you can base your usage on the manual tests.
If you, for example, use the manual_test_calculate_dose_static.py
you can update the settings in the way it is done on row 8-10. To run the analysis on your own file you can then change the call to main
on row 12 from main(settings=settings)
to main(file_path="<PATH-TO-YOUR-RDSR-FILE>", settings=settings)
I hope this helps you get started with PySkinDose and your own data!
Thank you very much!
Hi, I failed to run manual_test_calculate_dose_interactive.py and manual_test_calculate_dose_static.py. This is the error message I got. Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/pandas/io/sql.py", line 2262, in execute cur.execute(sql, *args) sqlite3.OperationalError: no such table: hvl_combined
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/Users/hanh4/workspace/PySkinDose/tests/manual_tests/manual_test_calculate_doseinteractive.py", line 12, in
main(settings=settings)
File "/opt/homebrew/lib/python3.11/site-packages/pyskindose/main.py", line 53, in main
= analyze_data(normalized_data=data_norm, settings=settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pyskindose/analyze_data.py", line 54, in analyze_data
patient, output = calculate_dose(normalized_data=normalized_data, settings=settings, table=table, pad=pad)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pyskindose/calculate_dose/calculate_dose.py", line 75, in calculate_dose
normalized_data = fetch_and_append_hvl(data_norm=normalized_data, inherent_filtration=settings.inherent_filtration)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pyskindose/geom_calc.py", line 243, in fetch_and_append_hvl
hvl_data = pd.read_sql_query("SELECT FROM hvl_combined", conn)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pandas/io/sql.py", line 486, in read_sql_query
return pandas_sql.read_query(
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pandas/io/sql.py", line 2326, in read_query
cursor = self.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pandas/io/sql.py", line 2274, in execute
raise ex from exc
pandas.errors.DatabaseError: Execution failed on sql 'SELECT FROM hvl_combined': no such table: hvl_combined
I already installed pyskindose by pip install, and I am using M1 Pro. Please let me know how to fix this.
I have one more question. When you calculate skin dose, do you calculate dose per each skin patch? or do you apply same dose to the patches in the beam area?