Skip to content

Commit

Permalink
Tethys-RC4
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffenhir committed Jul 5, 2022
2 parents 4863d18 + 5ad6ec9 commit 71f796c
Show file tree
Hide file tree
Showing 11 changed files with 267 additions and 57 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ jobs:
run: |
pip install setuptools wheel && `
cd .\pyinstaller\bootloader && `
(Get-Content .\wscript) -Replace "'run'", "'graxpert'" | Set-Content .\wscript && `
(Get-Content .\src\main.c) -Replace 'pyi_main\(', 'my_pyi_main(' | Set-Content .\src\main.c && `
(Get-Content .\src\pyi_main.h) -Replace 'pyi_main\(', 'my_pyi_main(' | Set-Content .\src\pyi_main.h && `
(Get-Content .\src\pyi_main.c) -Replace 'pyi_main\(', 'my_pyi_main(' | Set-Content .\src\pyi_main.c && `
python ./waf all && `
cd .. && `
(Get-Content .\setup.py) -Replace 'run.exe', 'graxpert.exe' | Set-Content .\setup.py && `
python setup.py install && `
cd .. && `
pip install -r requirements.txt
Expand Down Expand Up @@ -132,11 +134,13 @@ jobs:
run: |
pip install setuptools wheel && `
cd .\pyinstaller\bootloader && `
(Get-Content .\wscript) -Replace "'run'", "'graxpert'" | Set-Content .\wscript && `
(Get-Content .\src\main.c) -Replace 'pyi_main\(', 'my_pyi_main(' | Set-Content .\src\main.c && `
(Get-Content .\src\pyi_main.h) -Replace 'pyi_main\(', 'my_pyi_main(' | Set-Content .\src\pyi_main.h && `
(Get-Content .\src\pyi_main.c) -Replace 'pyi_main\(', 'my_pyi_main(' | Set-Content .\src\pyi_main.c && `
python ./waf all && `
cd .. && `
(Get-Content .\setup.py) -Replace 'run.exe', 'graxpert.exe' | Set-Content .\setup.py && `
python setup.py install && `
cd .. && `
pip install -r requirements.txt
Expand Down Expand Up @@ -229,4 +233,4 @@ jobs:
GraXpert-win64.exe
GraXpert-linux.zip
GraXpert-win64.zip
GraXpert-macos-x86_64.dmg
GraXpert-macos-x86_64.dmg
2 changes: 1 addition & 1 deletion forest-dark.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ namespace eval ttk::theme::forest-dark {
] -border 4 -sticky nsew

# Menubutton
ttk::style configure TMenubutton -padding {8 4 4 4}
ttk::style configure TMenubutton -padding {8 4 4 4} -anchor center

ttk::style element create Menubutton.button image \
[list $I(rect-basic) \
Expand Down
Binary file modified locales/de_DE/LC_MESSAGES/base.mo
Binary file not shown.
29 changes: 23 additions & 6 deletions locales/de_DE/LC_MESSAGES/base.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,25 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

msgid "Crop"
msgstr "Zuschneiden"

msgid "Crop mode on/off"
msgstr "Zuschnittsmodus an/aus"

msgid "Apply crop"
msgstr "Zuschnitt anwenden"

msgid "Background Extraction"
msgstr "Hintergrundentfernung"

#: src/gui.py:147
msgid " Loading"
msgstr " Laden"

#: src/gui.py:152
msgid "Load Image"
msgstr "Lade Bild"
msgstr "Bild laden"

#: src/gui.py:160
msgid " Stretch Options"
Expand All @@ -33,7 +44,7 @@ msgstr " Punktauswahl"

#: src/gui.py:176
msgid "Display points"
msgstr "Zeige Punkte"
msgstr "Punkte anzeigen"

#: src/gui.py:185 src/gui.py:191
msgid "Points per row: {}"
Expand All @@ -45,7 +56,7 @@ msgstr "Gittertoleranz: {}"

#: src/gui.py:231
msgid "Create Grid"
msgstr "Erstelle Gitter"
msgstr "Gitter erstellen"

#: src/gui.py:237
msgid "Reset Sample Points"
Expand All @@ -61,19 +72,19 @@ msgstr "Interpolationsmethode"

#: src/gui.py:287
msgid "Calculate Background"
msgstr "Berechne Hintergrund"
msgstr "Hintergrund berechnen"

#: src/gui.py:294
msgid " Saving"
msgstr " Speichern"

#: src/gui.py:308
msgid "Save Background"
msgstr "Speichere Hintergrund"
msgstr "Hintergrund speichern"

#: src/gui.py:315
msgid "Save Processed"
msgstr "Speichere Bild"
msgstr "Bild speichern"

#: src/gui.py:345
msgid "An error occurred while loading your picture."
Expand Down Expand Up @@ -204,6 +215,12 @@ msgstr "Samplefarbe: {}"
msgid "Spline order"
msgstr "Grad der Splines"

msgid "Language"
msgstr "Sprache"

msgid "Correction"
msgstr "Korrektur"

#: src/loadingframe.py:18
msgid "Calculating..."
msgstr "Berechne..."
Expand Down
15 changes: 11 additions & 4 deletions src/astroimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def update_display(self):
img_display = self.stretch()
img_display = img_display*255

if self.roworder == "TOP-DOWN":
img_display = np.flip(img_display, axis=0)
#if self.roworder == "TOP-DOWN":
# img_display = np.flip(img_display, axis=0)

if(img_display.shape[2] == 1):
self.img_display = Image.fromarray(img_display[:,:,0].astype(np.uint8))
Expand All @@ -77,8 +77,8 @@ def update_display(self):
def update_display_from_array(self, img_display):
img_display = img_display*255

if self.roworder == "TOP-DOWN":
img_display = np.flip(img_display, axis=0)
#if self.roworder == "TOP-DOWN":
# img_display = np.flip(img_display, axis=0)

if(img_display.shape[2] == 1):
self.img_display = Image.fromarray(img_display[:,:,0].astype(np.uint8))
Expand Down Expand Up @@ -118,6 +118,13 @@ def get_stretch(self):
elif(self.stretch_option.get() == "30% Bg, 2 sigma"):
return (0.3, 2)

def crop(self, startx, endx, starty, endy):
self.img_array = self.img_array[starty:endy,startx:endx,:]
self.img_display = self.img_display.crop((startx, starty, endx, endy))
self.width = self.img_array.shape[1]
self.height = self.img_array.shape[0]
return

def update_fits_header(self, original_header, background_mean):
if(original_header is None):
self.fits_header = fits.Header()
Expand Down
16 changes: 11 additions & 5 deletions src/background_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from radialbasisinterpolation import RadialBasisInterpolation


def extract_background(in_imarray, background_points, interpolation_type, smoothing, downscale_factor, sample_size, RBF_kernel, spline_order):
def extract_background(in_imarray, background_points, interpolation_type, smoothing,
downscale_factor, sample_size, RBF_kernel, spline_order, corr_type):

shm_imarray = shared_memory.SharedMemory(create=True, size=in_imarray.nbytes)
shm_background = shared_memory.SharedMemory(create=True, size=in_imarray.nbytes)
Expand All @@ -40,10 +41,15 @@ def extract_background(in_imarray, background_points, interpolation_type, smooth
for c in range(num_colors):
futures.insert(c, executor.submit(interpol, shm_imarray.name, shm_background.name, c, x_sub, y_sub, in_imarray.shape, interpolation_type, smoothing, downscale_factor, sample_size, RBF_kernel, spline_order, imarray.dtype))
wait(futures)

#Subtract background from image
mean = np.mean(background)
imarray[:,:,:] = imarray[:,:,:] - background[:,:,:] + mean

#Correction
if(corr_type == "Subtraction"):
mean = np.mean(background)
imarray[:,:,:] = imarray[:,:,:] - background[:,:,:] + mean
elif(corr_type == "Division"):
for c in range(num_colors):
mean = np.mean(imarray[:,:,c])
imarray[:,:,c] = imarray[:,:,c] / background[:,:,c] * mean

#clip image
imarray[:,:,:] = imarray.clip(min=0.0,max=1.0)
Expand Down
36 changes: 36 additions & 0 deletions src/collapsible_frame.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import tkinter as tk
from tkinter import ttk

class CollapsibleFrame(tk.Frame):

def __init__(self, parent, text="", *args, **options):
tk.Frame.__init__(self, parent, *args, **options)

self.show = tk.IntVar()
self.show.set(0)

self.title_frame = ttk.Frame(self)
self.title_frame.pack(fill="x", expand=1)

ttk.Label(self.title_frame, text=text, font="Verdana 10 bold").pack(side="left", fill="x", expand=1)

self.toggle_button = ttk.Checkbutton(self.title_frame, width=2, text='+', command=self.toggle,
variable=self.show, style='Toolbutton')
self.toggle_button.pack(side="left")

self.sub_frame = tk.Frame(self, relief="sunken", borderwidth=0)

def toggle(self):
if bool(self.show.get()):
self.sub_frame.pack(fill="x", expand=1)
self.toggle_button.configure(text='-')
else:
self.sub_frame.forget()
self.toggle_button.configure(text='+')

self.update()
self.master.update()
width = self.master.winfo_width()
self.master.master.configure(width=width)
self.master.master.configure(scrollregion=self.master.master.bbox("all"))
self.master.master.yview_moveto("0.0")
Loading

0 comments on commit 71f796c

Please sign in to comment.