Skip to content

Commit

Permalink
Dione RC-1
Browse files Browse the repository at this point in the history
  • Loading branch information
schmelly committed Nov 16, 2022
2 parents 9336ea2 + edb3c72 commit edb8ca5
Show file tree
Hide file tree
Showing 22 changed files with 755 additions and 253 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'
- name: checkout repository
uses: actions/checkout@v3
- name: install dependencies
run: |
pip install setuptools wheel pyinstaller && \
pip install setuptools wheel pyinstaller==5.6.2 && \
pip install -r requirements.txt
- name: patch version
run: |
Expand All @@ -43,12 +43,12 @@ jobs:
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'
- name: checkout repository
uses: actions/checkout@v3
- name: install dependencies
run: |
pip install setuptools wheel pyinstaller && \
pip install setuptools wheel pyinstaller==5.6.2 && \
pip install -r requirements.txt
- name: patch version
run: |
Expand Down Expand Up @@ -77,15 +77,15 @@ jobs:
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'
- name: checkout repository
uses: actions/checkout@v3
- name: checkout pyinstaller
uses: actions/checkout@v3
with:
repository: pyinstaller/pyinstaller
path: ./pyinstaller
ref: v5.0
ref: v5.6.2
- name: install dependencies
run: |
pip install setuptools wheel && `
Expand Down Expand Up @@ -121,15 +121,15 @@ jobs:
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'
- name: checkout repository
uses: actions/checkout@v3
- name: checkout pyinstaller
uses: actions/checkout@v3
with:
repository: pyinstaller/pyinstaller
path: ./pyinstaller
ref: v5.0
ref: v5.6.2
- name: install dependencies
run: |
pip install setuptools wheel && `
Expand Down Expand Up @@ -165,12 +165,12 @@ jobs:
runs-on: macos-10.15
steps:
- name: setup python
run: brew install python-tk@3.9
run: brew install python-tk@3.10
- name: checkout repository
uses: actions/checkout@v3
- name: install dependencies
run: |
pip3 install setuptools wheel pyinstaller && \
pip3 install setuptools wheel pyinstaller==5.6.2 && \
pip3 install -r requirements.txt
- name: patch version
run: |
Expand Down Expand Up @@ -233,4 +233,4 @@ jobs:
GraXpert-win64.exe
GraXpert-linux.zip
GraXpert-win64.zip
GraXpert-macos-x86_64.dmg
GraXpert-macos-x86_64.dmg
4 changes: 2 additions & 2 deletions GraXpert-linux-zip.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ a = Analysis(['./src/gui.py'],
pathex=[],
binaries=[],
datas=[('./img/*', './img/'), ('./forest-dark.tcl', './'), ('./forest-dark/*', './forest-dark/')],
hiddenimports=['PIL._tkinter_finder'],
hiddenimports=['PIL._tkinter_finder', 'tkinter'],
hookspath=['./releng'],
hooksconfig={},
runtime_hooks=[],
Expand All @@ -30,7 +30,7 @@ exe = EXE(pyz,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
Expand Down
4 changes: 2 additions & 2 deletions GraXpert-linux.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ a = Analysis(['./src/gui.py'],
pathex=[],
binaries=[],
datas=[('./img/*', './img/'), ('./forest-dark.tcl', './'), ('./forest-dark/*', './forest-dark/')],
hiddenimports=['PIL._tkinter_finder'],
hiddenimports=['PIL._tkinter_finder', 'tkinter'],
hookspath=['./releng'],
hooksconfig={},
runtime_hooks=[],
Expand All @@ -35,7 +35,7 @@ exe = EXE(pyz,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
Expand Down
4 changes: 2 additions & 2 deletions GraXpert-macos-x86_64.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ a = Analysis(['./src/gui.py'],
pathex=[],
binaries=[],
datas=[('./img/*', './img/'), ('./forest-dark.tcl', './'), ('./forest-dark/*', './forest-dark/')],
hiddenimports=['PIL._tkinter_finder'],
hiddenimports=['PIL._tkinter_finder', 'tkinter'],
hookspath=['./releng'],
hooksconfig={},
runtime_hooks=[],
Expand All @@ -29,7 +29,7 @@ exe = EXE(pyz,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch='x86_64',
Expand Down
19 changes: 15 additions & 4 deletions GraXpert-win64-zip.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ a = Analysis(['./src/gui.py'],
pathex=[],
binaries=[],
datas=[('./img/*', './img/'), ('./forest-dark.tcl', './'), ('./forest-dark/*', './forest-dark/')],
hiddenimports=['PIL._tkinter_finder'],
hiddenimports=['PIL._tkinter_finder', 'tkinter'],
hookspath=['./releng'],
hooksconfig={},
runtime_hooks=[],
Expand All @@ -19,17 +19,27 @@ a = Analysis(['./src/gui.py'],
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
splash = Splash(
'img/graXpert_Startbadge_Dione.png',
binaries=a.binaries,
datas=a.datas,
text_pos=None,
text_size=12,
minify_script=True,
always_on_top=True,
)

exe = EXE(pyz,
a.scripts,
a.scripts,
splash,
[],
exclude_binaries=True,
name='GraXpert',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
Expand All @@ -38,7 +48,8 @@ coll = COLLECT(exe,
a.binaries,
Tree('locales', prefix='locales/'),
a.zipfiles,
a.datas,
a.datas,
splash.binaries,
strip=False,
upx=True,
upx_exclude=[],
Expand Down
14 changes: 12 additions & 2 deletions GraXpert-win64.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ a = Analysis(['./src/gui.py'],
pathex=[],
binaries=[],
datas=[('./img/*', './img/'), ('./forest-dark.tcl', './'), ('./forest-dark/*', './forest-dark/')],
hiddenimports=['PIL._tkinter_finder'],
hiddenimports=['PIL._tkinter_finder', 'tkinter'],
hookspath=['./releng'],
hooksconfig={},
runtime_hooks=[],
Expand All @@ -19,9 +19,19 @@ a = Analysis(['./src/gui.py'],
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
splash = Splash(
'img/graXpert_Startbadge_Dione.png',
binaries=a.binaries,
datas=a.datas,
text_pos=None,
text_size=12,
minify_script=True,
always_on_top=True,
)

exe = EXE(pyz,
a.scripts,
splash,
a.binaries,
Tree('locales', prefix='locales/'),
a.zipfiles,
Expand All @@ -34,7 +44,7 @@ exe = EXE(pyz,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
Expand Down
Binary file added img/graXpert_Startbadge_Dione.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions img/graXpert_Startbadge_Dione.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/graXpert_Startbadge_Tethys.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions img/graXpert_Startbadge_Tethys.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions locales/base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ msgstr ""
msgid "Adjust the number of points per row for the grid created by automatic background selection."
msgstr ""

msgid "If enabled, additional grid points are automatically created based on 1) the luminance of the sample just added and 2) the grid tolerance slider below."
msgstr ""

#: src/tooltip.py:173
msgid "Choose between different interpolation methods."
msgstr ""
Expand Down
Binary file modified locales/de_DE/LC_MESSAGES/base.mo
Binary file not shown.
7 changes: 7 additions & 0 deletions locales/de_DE/LC_MESSAGES/base.po
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ msgstr " Punktauswahl"
msgid "Display points"
msgstr "Punkte anzeigen"

#: src/gui.py:176
msgid "Flooded generation"
msgstr "Geflutete Generierung"

#: src/gui.py:185 src/gui.py:191
msgid "Points per row: {}"
msgstr "Punkte pro Reihe: {}"
Expand Down Expand Up @@ -260,6 +264,9 @@ msgstr "Die Toleranz bestimmt einen Schwellwert für das Ignorieren von Punkten
msgid "Adjust the number of points per row for the grid created by automatic background selection."
msgstr "Bestimmt die Anzahl an Punkten pro Reihe, die mit der Gitterauswahl erstellt werden"

msgid "If enabled, additional grid points are automatically created based on 1) the luminance of the sample just added and 2) the grid tolerance slider below."
msgstr "Wenn aktiviert, werden automatisch zusätzliche Gitterpunkte erstellt, die 1) auf der Luminanz des soeben hinzugefügten Punkts und 2) auf dem Toleranz-Schieberegler (s.u.) basieren."

#: src/tooltip.py:173
msgid "Choose between different interpolation methods."
msgstr "Wähle zwischen verschiedenen Interpolationsmethoden"
Expand Down
45 changes: 40 additions & 5 deletions src/astroimage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import json
import numpy as np
from xisf import XISF
from astropy.io import fits
Expand All @@ -7,6 +8,7 @@
from skimage.util import img_as_ubyte, img_as_uint
from PIL import Image, ImageEnhance
from stretch import stretch
from preferences import app_state_2_fitsheader

class AstroImage:
def __init__(self, stretch_option, saturation):
Expand All @@ -16,7 +18,7 @@ def __init__(self, stretch_option, saturation):
self.img_format = None
self.fits_header = None
self.xisf_metadata = {}
self.image_metadata = {}
self.image_metadata = {"FITSKeywords": {}}
self.stretch_option = stretch_option
self.saturation = saturation
self.width = 0
Expand All @@ -43,13 +45,16 @@ def set_from_file(self, directory):
xisf = XISF(directory)
self.xisf_metadata = xisf.get_file_metadata()
self.image_metadata = xisf.get_images_metadata()[0]
self.fits_header = fits.Header()
self.xisf_imagedata_2_fitsheader()
img_array = xisf.read_image(0)

entry = {'id': 'BackgroundExtraction', 'type': 'String', 'value': 'GraXpert'}
self.image_metadata['XISFProperties'] = {"ProcessingHistory": entry}

else:
img_array = io.imread(directory)
self.fits_header = fits.Header()

# Reshape greyscale picture to shape (y,x,1)
if(len(img_array.shape) == 2):
Expand Down Expand Up @@ -146,16 +151,18 @@ def crop(self, startx, endx, starty, endy):
self.height = self.img_array.shape[0]
return

def update_fits_header(self, original_header, background_mean):
if(original_header is None):
def update_fits_header(self, original_header, background_mean, app, app_state):
if(self.fits_header is None):
self.fits_header = fits.Header()
else:
self.fits_header = original_header

self.fits_header["BG-EXTR"] = "GraXpert"
self.fits_header["CBG-1"] = background_mean
self.fits_header["CBG-2"] = background_mean
self.fits_header["CBG-3"] = background_mean
self.fits_header = app_state_2_fitsheader(app, app_state, self.fits_header)


if "ROWORDER" in self.fits_header:
self.roworder = self.fits_header["ROWORDER"]
Expand All @@ -173,6 +180,7 @@ def save(self, dir, saveas_type):
io.imsave(dir, image_converted)

elif(saveas_type == "16 bit XISF" or saveas_type == "32 bit XISF"):
self.update_xisf_imagedata()
XISF.write(dir, image_converted, creator_app = "GraXpert", image_metadata = self.image_metadata, xisf_metadata = self.xisf_metadata)
else:
if(image_converted.shape[-1] == 3):
Expand Down Expand Up @@ -218,4 +226,31 @@ def update_saturation(self):
self.img_display_saturated = ImageEnhance.Color(self.img_display)
self.img_display_saturated = self.img_display_saturated.enhance(self.saturation.get())

return
return

def update_xisf_imagedata(self):
for key in self.fits_header.keys():
if key == "BG-PTS":
bg_pts = json.loads(self.fits_header["BG-PTS"])

for i in range(len(bg_pts)):
self.image_metadata["FITSKeywords"]["BG-PTS" + str(i)] = [{"value": bg_pts[i],"comment": ""}]
else:

value = str(self.fits_header[key])
comment = str(self.fits_header.comments[key])
self.image_metadata["FITSKeywords"][key] = [{"value": value, "comment":comment}]

def xisf_imagedata_2_fitsheader(self):
bg_pts = []
for key in self.image_metadata["FITSKeywords"].keys():
if key.startswith("BG-PTS"):
bg_pts.append(json.loads(self.image_metadata["FITSKeywords"][key][0]["value"]))

value = self.image_metadata["FITSKeywords"][key][0]["value"]
comment = self.image_metadata["FITSKeywords"][key][0]["comment"]

self.fits_header[key] = (value, comment)

if len(bg_pts) > 0:
self.fits_header["BG-PTS"] = str(bg_pts)
Loading

0 comments on commit edb8ca5

Please sign in to comment.