Skip to content
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
44 changes: 44 additions & 0 deletions .github/workflows/executable_build_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and Test Executables
on:
push:
branches-ignore:
[main]
workflow_dispatch:

jobs:
release:
name: Build and Test Executables
runs-on: windows-2022
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
shell: pwsh
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install .

- name: Build EXEs
shell: pwsh
run: |
pyinstaller correct_images_onefile.spec --noconfirm --clean
pyinstaller get_corrections_onefile.spec --noconfirm --clean

- name: Test EXEs
shell: pwsh
run: |
dist/ImageryCorrector.exe tests/6x_images --output_path dist/6x_images_test_output
dist/GetCorrectionsCsv.exe tests/6x_images --output_path dist/6x_images_test_output_csv

8 changes: 4 additions & 4 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Lint and Test
on:
push:
branches-ignore:
[master]
[main]

jobs:
lint:
Expand All @@ -16,9 +16,9 @@ jobs:

- name: Install Exiftool
run: |
wget https://exiftool.org/Image-ExifTool-13.50.tar.gz
gzip -dc Image-ExifTool-13.50.tar.gz | tar -xf -
cd Image-ExifTool-13.50
wget https://exiftool.org/Image-ExifTool-13.55.tar.gz
gzip -dc Image-ExifTool-13.55.tar.gz | tar -xf -
cd Image-ExifTool-13.55
perl Makefile.PL
sudo make install
cd ..
Expand Down
58 changes: 42 additions & 16 deletions .github/workflows/main-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ on:
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-22.04
runs-on: windows-2022
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -26,21 +26,47 @@ jobs:
file: 'pyproject.toml'
field: 'tool.poetry.version'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
shell: pwsh
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install .

- name: Build EXEs
shell: pwsh
run: |
pyinstaller correct_images_onefile.spec --noconfirm --clean
pyinstaller get_corrections_onefile.spec --noconfirm --clean
pyinstaller correct_images_gui_onefile.spec --noconfirm --clean

- name: Create zip files
run: |
cd "$GITHUB_WORKSPACE"
zip -r dist/ImageryCorrector.zip dist/ImageryCorrector.exe
zip -r dist/GetCorrectionsCsv.zip dist/GetCorrectionsCsv.exe
zip -r dist/SenteraRadiometricCorrectionsGUI.zip dist/SenteraRadiometricCorrectionsGUI.exe



- name: Define TAG
shell: pwsh
run: |
export VERSION="${{ steps.read_toml.outputs.value }}"
echo "TAG=v$VERSION" >> $GITHUB_ENV
"TAG=v${{ steps.read_toml.outputs.value }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Create Release
uses: actions/github-script@v6
uses: softprops/action-gh-release@v2
with:
result-encoding: string
retries: 3
script: |
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: process.env.TAG,
target_commitish: context.sha,
name: process.env.TAG,
generate_release_notes: true
})
tag_name: ${{ env.TAG }}
name: ${{ env.TAG }}
target_commitish: ${{ github.sha }}
generate_release_notes: true
files: |
dist/ImageryCorrector.zip
dist/GetCorrectionsCsv.zip
dist/SenteraRadiometricCorrectionsGUI.zip
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
additional_dependencies: [
'flake8-docstrings',
'flake8-builtins',
'flake8-logging-format',
'flake8-logging',
'flake8-rst-docstrings',
'pygments',
'pep8-naming'
Expand Down
5 changes: 4 additions & 1 deletion correct_images_dir.spec
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# -*- mode: python ; coding: utf-8 -*-

from PyInstaller.utils.hooks import copy_metadata

block_cipher = None

metadata_datas = copy_metadata('imageio') + copy_metadata('imgcorrect')


a = Analysis(['scripts\\correct_images.py'],
pathex=['.'],
binaries=[],
datas=[('exiftool/exiftool.exe', '.')],
datas=[('exiftool/exiftool.exe', '.'), ('cfg/exiftool.cfg', 'cfg'), ('cfg/reg_config.ini', 'cfg')] + metadata_datas,
hiddenimports=['pkg_resources.py2_warn'],
hookspath=[],
runtime_hooks=[],
Expand Down
8 changes: 6 additions & 2 deletions correct_images_gui_onefile.spec
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# -*- mode: python ; coding: utf-8 -*-

from PyInstaller.utils.hooks import copy_metadata

block_cipher = None

metadata_datas = copy_metadata('imageio') + copy_metadata('imgcorrect')


a = Analysis(['scripts\\correct_images_gui.py'],
pathex=['.'],
binaries=[],
datas=[('exiftool/exiftool.exe', '.'), ('cfg/exiftool.cfg', 'cfg'), ('cfg/reg_config.ini', 'cfg'), ('sentera_radiometric_corrections_icon.ico', '.')],
datas=[('exiftool/exiftool.exe', '.'), ('cfg/exiftool.cfg', 'cfg'), ('cfg/reg_config.ini', 'cfg'), ('sentera_radiometric_corrections_icon.ico', '.')] + metadata_datas,
hiddenimports=['pkg_resources.py2_warn'],
hookspath=[],
runtime_hooks=[],
Expand All @@ -23,7 +27,7 @@ exe = EXE(pyz,
a.zipfiles,
a.datas,
[],
name='Sentera Radiometric Corrections GUI',
name='SenteraRadiometricCorrectionsGUI',
icon='sentera_radiometric_corrections_icon.ico',
debug=False,
bootloader_ignore_signals=False,
Expand Down
6 changes: 5 additions & 1 deletion correct_images_onefile.spec
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# -*- mode: python ; coding: utf-8 -*-

from PyInstaller.utils.hooks import copy_metadata

block_cipher = None

metadata_datas = copy_metadata('imageio') + copy_metadata('imgcorrect')


a = Analysis(['scripts\\correct_images.py'],
pathex=['.'],
binaries=[],
datas=[('exiftool/exiftool.exe', '.'), ('cfg/exiftool.cfg', 'cfg'), ('cfg/reg_config.ini', 'cfg')],
datas=[('exiftool/exiftool.exe', '.'), ('cfg/exiftool.cfg', 'cfg'), ('cfg/reg_config.ini', 'cfg')] + metadata_datas,
hiddenimports=['pkg_resources.py2_warn'],
hookspath=[],
runtime_hooks=[],
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ dependencies:
# subpackage dependencies
# Sentera dependencies
- pip:
- git+https://github.com/SenteraLLC/py-image-metadata-parser.git@v2.0.4
- git+https://github.com/SenteraLLC/py-image-metadata-parser.git@v2.0.10
6 changes: 5 additions & 1 deletion get_corrections_dir.spec
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# -*- mode: python ; coding: utf-8 -*-

from PyInstaller.utils.hooks import copy_metadata

block_cipher = None

metadata_datas = copy_metadata('imageio') + copy_metadata('imgcorrect')


a = Analysis(['scripts\\get_corrections.py'],
pathex=['.'],
binaries=[],
datas=[('exiftool/exiftool.exe', '.')],
datas=[('exiftool/exiftool.exe', '.'), ('cfg/exiftool.cfg', 'cfg'), ('cfg/reg_config.ini', 'cfg')] + metadata_datas,
hiddenimports=['pkg_resources.py2_warn'],
hookspath=[],
runtime_hooks=[],
Expand Down
6 changes: 5 additions & 1 deletion get_corrections_onefile.spec
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# -*- mode: python ; coding: utf-8 -*-

from PyInstaller.utils.hooks import copy_metadata

block_cipher = None

metadata_datas = copy_metadata('imageio') + copy_metadata('imgcorrect')


a = Analysis(['scripts\\get_corrections.py'],
pathex=['.'],
binaries=[],
datas=[('exiftool/exiftool.exe', '.'), ('cfg/exiftool.cfg', 'cfg'), ('cfg/reg_config.ini', 'cfg')],
datas=[('exiftool/exiftool.exe', '.'), ('cfg/exiftool.cfg', 'cfg'), ('cfg/reg_config.ini', 'cfg')] + metadata_datas,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above, are these extra files (exiftool cfg files) needed in both the onefile and dir version? I'd expect if it's needed in one it would be needed for the others?

hiddenimports=['pkg_resources.py2_warn'],
hookspath=[],
runtime_hooks=[],
Expand Down
3 changes: 3 additions & 0 deletions imgcorrect/corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ def get_sensitivity(row):
]
)
return 1 / sensitivity
elif "drone-dji:SensorGainAdjustment" in xmp:
gain_adj = float(xmp["drone-dji:SensorGainAdjustment"])
return gain_adj
Comment on lines +337 to +339
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me. I can't think of any case where we would have Camera:BandSensitivity and drone-dji:SensorGainAdjustment at the same time, so we shouldn't have to worry about the order of the if statements.

else:
return 1

Expand Down
3 changes: 2 additions & 1 deletion imgcorrect/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def apply_sensor_settings(image_df):
# remove images that don't appear in every band
new_image_df = new_image_df[new_image_df.ID.isin(v.index[v.eq(band_count)])]
logger.info(
f"Skipping {images_before_filtering - len(new_image_df.index)} images because they don't have data for all bands"
"Skipping %s images because they don't have data for all bands",
images_before_filtering - len(new_image_df.index),
Comment on lines +92 to +93
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find f-strings a bit easier to read for most cases, but it really doesn't matter here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, for some reason the linter doesn't like using f strings with logger calls

)

return new_image_df
Expand Down
4 changes: 2 additions & 2 deletions imgcorrect/thermal_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def convert_thermal(input_path, output_path, exiftool_path):
try:
os.remove(os.path.join(output_path, file))
logger.info("additional file deleted")
except Exception as e:
logger.error(f"File delete failed with error {e}")
except Exception:
logger.exception("File delete failed")

else:
if overwrite:
Expand Down
Loading
Loading