starbash 0.1.9__py3-none-any.whl → 0.1.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. repo/__init__.py +1 -1
  2. repo/manager.py +14 -23
  3. repo/repo.py +52 -10
  4. starbash/__init__.py +10 -3
  5. starbash/aliases.py +145 -0
  6. starbash/analytics.py +3 -2
  7. starbash/app.py +512 -473
  8. starbash/check_version.py +18 -0
  9. starbash/commands/__init__.py +2 -1
  10. starbash/commands/info.py +88 -14
  11. starbash/commands/process.py +76 -24
  12. starbash/commands/repo.py +41 -68
  13. starbash/commands/select.py +141 -142
  14. starbash/commands/user.py +88 -23
  15. starbash/database.py +219 -112
  16. starbash/defaults/starbash.toml +24 -3
  17. starbash/exception.py +21 -0
  18. starbash/main.py +29 -7
  19. starbash/paths.py +35 -5
  20. starbash/processing.py +724 -0
  21. starbash/recipes/README.md +3 -0
  22. starbash/recipes/master_bias/starbash.toml +16 -19
  23. starbash/recipes/master_dark/starbash.toml +33 -0
  24. starbash/recipes/master_flat/starbash.toml +26 -18
  25. starbash/recipes/osc.py +190 -0
  26. starbash/recipes/osc_dual_duo/starbash.toml +54 -44
  27. starbash/recipes/osc_simple/starbash.toml +82 -0
  28. starbash/recipes/osc_single_duo/starbash.toml +51 -32
  29. starbash/recipes/seestar/starbash.toml +82 -0
  30. starbash/recipes/starbash.toml +30 -9
  31. starbash/selection.py +32 -36
  32. starbash/templates/repo/master.toml +7 -3
  33. starbash/templates/repo/processed.toml +15 -0
  34. starbash/templates/userconfig.toml +9 -0
  35. starbash/toml.py +13 -13
  36. starbash/tool.py +230 -96
  37. starbash-0.1.15.dist-info/METADATA +216 -0
  38. starbash-0.1.15.dist-info/RECORD +45 -0
  39. starbash/recipes/osc_dual_duo/starbash.py +0 -151
  40. starbash-0.1.9.dist-info/METADATA +0 -145
  41. starbash-0.1.9.dist-info/RECORD +0 -37
  42. {starbash-0.1.9.dist-info → starbash-0.1.15.dist-info}/WHEEL +0 -0
  43. {starbash-0.1.9.dist-info → starbash-0.1.15.dist-info}/entry_points.txt +0 -0
  44. {starbash-0.1.9.dist-info → starbash-0.1.15.dist-info}/licenses/LICENSE +0 -0
@@ -1,151 +0,0 @@
1
- # pyright: reportUndefinedVariable=false
2
- # ('context' and 'logger' are injected by the starbash runtime)
3
-
4
- import os
5
- from glob import glob
6
- from starbash.tool import tools
7
-
8
- siril = tools["siril"]
9
-
10
- delete_temps = False
11
-
12
-
13
- # FIXME move this into main starbash
14
- def perhaps_delete_temps(temps: list[str]) -> None:
15
- if delete_temps:
16
- for t in temps:
17
- for path in glob(f"{context['process_dir']}/{t}_*"):
18
- os.remove(path)
19
-
20
-
21
- def normalize_target_name(name: str) -> str:
22
- """Converts a target name to an any filesystem-safe format by removing spaces"""
23
- return name.replace(" ", "").upper()
24
-
25
-
26
- def make_stacked(sessionconfig: str, variant: str, output_file: str):
27
- """
28
- Registers and stacks all pre-processed light frames for a given filter configuration
29
- across all sessions.
30
- """
31
- # The sequence name for all frames of this variant across all sessions
32
- # e.g. Ha_bkg_pp_light_cHaOiii
33
- merged_seq_base = f"all_{variant}_bkg_pp_light"
34
-
35
- # Absolute path for the output stacked file
36
- stacked_output_path = glob(f"{context["process_dir"]}/{output_file}.fit*")
37
-
38
- if stacked_output_path:
39
- logger.info(f"Using existing stacked file: {stacked_output_path}")
40
- else:
41
- # Merge all frames (from multiple sessions and configs) use those for stacking
42
- frames = glob(
43
- f"{context["process_dir"]}/{variant}_bkg_pp_light_s*_c{sessionconfig}_*.fit*"
44
- )
45
-
46
- logger.info(
47
- f"Registering and stacking {len(frames)} frames for {sessionconfig}/{variant} -> {stacked_output_path}"
48
- )
49
-
50
- # Siril commands for registration and stacking. We run this in process_dir.
51
- commands = f"""
52
- link {merged_seq_base} -out={context["process_dir"]}
53
- cd {context["process_dir"]}
54
-
55
- register {merged_seq_base}
56
- stack r_{merged_seq_base} rej g 0.3 0.05 -filter-wfwhm=3k -norm=addscale -output_norm -32b -out={output_file}
57
-
58
- # and flip if required
59
- mirrorx_single {output_file}
60
- """
61
-
62
- context["input_files"] = frames
63
- siril.run_in_temp_dir(commands, context=context)
64
-
65
- perhaps_delete_temps([merged_seq_base, f"r_{merged_seq_base}"])
66
-
67
-
68
- def make_renormalize():
69
- """
70
- Aligns the stacked images (Sii, Ha, OIII) and renormalizes Sii and OIII
71
- to match the flux of the Ha channel.
72
- """
73
- logger.info("Aligning and renormalizing stacked images.")
74
-
75
- # Define file basenames for the stacked images created in the 'process' directory
76
- ha_base = "results_00001"
77
- oiii_base = "results_00002"
78
- sii_base = "results_00003"
79
-
80
- # Define final output paths. The 'results' directory is a symlink in the work dir.
81
- results_dir = f"{context["targets"]}/{normalize_target_name(context["target"])}"
82
- os.makedirs(results_dir, exist_ok=True)
83
-
84
- ha_final_path = f"{results_dir}/stacked_Ha.fits"
85
- oiii_final_path = f"{results_dir}/stacked_OIII.fits"
86
-
87
- # Check if final files already exist to allow resuming
88
- if all(os.path.exists(f) for f in [ha_final_path, oiii_final_path]):
89
- logger.info("Renormalized files already exist, skipping.")
90
- return
91
-
92
- # Basenames for registered files (output of 'register' command)
93
- r_ha = f"r_{ha_base}"
94
- r_oiii = f"r_{oiii_base}"
95
-
96
- # Pixel math formula for renormalization.
97
- # It matches the median and spread (MAD) of a channel to a reference channel (Ha).
98
- # Formula: new = old * (MAD(ref)/MAD(old)) - (MAD(ref)/MAD(old)) * MEDIAN(old) + MEDIAN(ref)
99
- pm_oiii = f'"${r_oiii}$*mad(${r_ha}$)/mad(${r_oiii}$)-mad(${r_ha}$)/mad(${r_oiii}$)*median(${r_oiii}$)+median(${r_ha}$)"'
100
-
101
- # Siril commands to be executed in the 'process' directory
102
- commands = f"""
103
- # -transf=shift fails sometimes, which I guess is possible because we have multiple sessions with possible different camera rotation
104
- # -interp=none also fails sometimes, so let default interp happen
105
- register results
106
- pm {pm_oiii}
107
- update_key FILTER Oiii "OSC dual Duo filter extracted"
108
- save "{oiii_final_path}"
109
- load {r_ha}
110
- update_key FILTER Ha "OSC dual Duo filter extracted"
111
- save "{ha_final_path}"
112
- """
113
-
114
- if os.path.exists(f"{results_dir}/{sii_base}.fit"):
115
- logger.info(f"Doing renormalisation of extra Sii channel")
116
-
117
- sii_final_path = f"{results_dir}/stacked_Sii.fits"
118
- r_sii = f"r_{sii_base}"
119
- pm_sii = f'"${r_sii}$*mad(${r_ha}$)/mad(${r_sii}$)-mad(${r_ha}$)/mad(${r_sii}$)*median(${r_sii}$)+median(${r_ha}$)"'
120
- commands += f"""
121
- pm {pm_sii}
122
- update_key FILTER Sii "OSC dual Duo filter extracted"
123
- save "{sii_final_path}"
124
- """
125
-
126
- siril.run(context["process_dir"], commands, context=context)
127
- logger.info(f"Saved final renormalized images to {results_dir}")
128
-
129
-
130
- def osc_dual_duo_post_session():
131
- logger.info("Running osc_dual_duo_post_session python script")
132
- logger.info("Using context: %s", context)
133
-
134
- # red output channel - from the SiiOiii filter Sii is on the 672nm red channel (mistakenly called Ha by siril)
135
- make_stacked("SiiOiii", "Ha", f"results_00001")
136
-
137
- # green output channel - from the HaOiii filter Ha is on the 656nm red channel
138
- make_stacked("HaOiii", "Ha", f"results_00001")
139
-
140
- # blue output channel - both filters have Oiii on the 500nm blue channel. Note the case here is uppercase to match siril output
141
- make_stacked("*", "OIII", f"results_00002")
142
-
143
- # There might be an old/state autogenerated .seq file, delete it so it doesn't confuse renormalize
144
- results_seq_path = f"{context["process_dir"]}/results_.seq"
145
- if os.path.exists(results_seq_path):
146
- os.remove(results_seq_path)
147
-
148
- make_renormalize()
149
-
150
-
151
- osc_dual_duo_post_session()
@@ -1,145 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: starbash
3
- Version: 0.1.9
4
- Summary: A tool for automating/standardizing/sharing astrophotography workflows.
5
- License-File: LICENSE
6
- Author: Kevin Hester
7
- Author-email: kevinh@geeksville.com
8
- Requires-Python: >=3.12,<3.15
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.12
11
- Classifier: Programming Language :: Python :: 3.13
12
- Classifier: Programming Language :: Python :: 3.14
13
- Requires-Dist: astropy (>=7.1.1,<8.0.0)
14
- Requires-Dist: multidict (>=6.7.0,<7.0.0)
15
- Requires-Dist: platformdirs (>=4.5.0,<5.0.0)
16
- Requires-Dist: restrictedpython (>=8.1,<9.0)
17
- Requires-Dist: rich (>=14.2.0,<15.0.0)
18
- Requires-Dist: sentry-sdk (>=2.42.1,<3.0.0)
19
- Requires-Dist: tomlkit (>=0.13.3,<0.14.0)
20
- Requires-Dist: typer (>=0.20.0,<0.21.0)
21
- Description-Content-Type: text/markdown
22
-
23
- # [Starbash](https://github.com/geeksville/starbash)
24
-
25
- <img src="https://raw.githubusercontent.com/geeksville/starbash/refs/heads/main/img/icon.png" alt="Starbash: Astrophotography workflows simplified" width="30%" align="right" style="margin-bottom: 20px;">
26
-
27
- [![PyPI - Version](https://img.shields.io/pypi/v/starbash)](https://pypi.org/project/starbash/)
28
- [![GitHub branch check runs](https://img.shields.io/github/check-runs/geeksville/starbash/main)](https://github.com/geeksville/starbash/actions)
29
- [![codecov](https://codecov.io/github/geeksville/starbash/graph/badge.svg?token=47RE10I7O1)](https://codecov.io/github/geeksville/starbash)
30
-
31
- A tool for automating/standardizing/sharing astrophotography workflows.
32
-
33
- * Automatic - with sensible defaults, that you can change as needed.
34
- * Easy - provides a 'seestar like' starting-point for autoprocessing all your sessions (by default).
35
- * Fast - even with large image repositories. Automatic master bias and flat generation and reasonable defaults
36
- * Sharable - you can share/use recipes for image preprocessing flows.
37
-
38
- (This project is currently 'alpha' and missing recipes for some workflows, but adding new recipes is easy and we're happy to help. Please file a github issue if your images are not auto-processed and we'll work out a fix.)
39
-
40
- <br clear="right">
41
-
42
- # Current status
43
-
44
- Not quite ready 😊. But making good progress.
45
-
46
- See the current [TODO](TODO.md) file for work items. I'll be looking for pre-alpha testers/feedback soon.
47
-
48
- ![Sample session movie](https://raw.githubusercontent.com/geeksville/starbash/refs/heads/main/doc/vhs/sample-session.gif)
49
-
50
- ## Current features
51
-
52
- * Automatically recognizes and auto-parses the default NINA, Asiair and Seestar raw file repos (adding support for other layouts is easy)
53
- * Multisession support by default (including automatic selection of correct flats, biases and dark frames)
54
- * 'Repos' can contain raw files, generated masters, preprocessed files, or recipes.
55
-
56
- ## Features coming soon
57
-
58
- * Automatically performs **complete** preprocessing on OSC (broadband, narrowband or dual Duo filter), Mono (LRGB, SHO) data. i.e. give you 'seestar level' auto-preprocessing, so you only need to do the (optional) custom post-processing.
59
- * Generates a per target report/config file which can be customized if the detected defaults or preprocessing are not what you want
60
- * 'Recipes' provide repeatable/human-readable/sharable descriptions of all processing steps
61
- * Repos can be on the local disk or shared via HTTPS/github/etc. This is particularly useful for recipe repos
62
- * Uses Siril and Graxpert for its pre-processing operations (support for Pixinsight based recipes will probably be coming at some point...)
63
- * The target report can be used to auto generate a human friendly 'postable/sharable' report about that image
64
- * Target reports are sharable so that you can request comments by others and others can rerender with different settings
65
-
66
- ## Installing
67
-
68
- Currently the easiest way to install this command-line based tool is to install is via [pipx](https://pipx.pypa.io/stable/). If you don't already have pipx and you have python installed, you can auto install it by running "pip install --user pipx." If you don't have python installed see the pipx link for pipx installers for any OS.
69
-
70
- Once pipx is installed just run the following **two** commands (the sb --install-completion will make TAB auto-complete automatically complete sb options (for most platforms)). Installing auto-complete is **highly** recommended because it makes entering starbash commands fast - by pressing the TAB key:
71
-
72
- ```
73
- ➜ pipx install starbash
74
- installed package starbash 0.1.3, installed using Python 3.12.3
75
- These apps are now globally available
76
- - sb
77
- - starbash
78
- done! ✨ 🌟 ✨
79
-
80
- ➜ sb --install-completion
81
- bash completion installed in /home/.../sb.sh
82
- Completion will take effect once you restart the terminal
83
-
84
- ```
85
-
86
- FIXME - add getting started instructions (possibly with a screenshare video)
87
-
88
- ## Supported commands
89
-
90
- ### Repository Management
91
- - `sb repo list [--verbose]` - List installed repos (use `-v` for details)
92
- - `sb repo add [--master] <filepath|URL>` - Add a repository, optionally specifying the type
93
- - `sb repo remove <REPOURL>` - Remove the indicated repo from the repo list
94
- - `sb repo reindex [--force] <REPOURL>` - Reindex the specified repo (or all repos if none specified)
95
-
96
- ### User Preferences
97
- - `sb user name "Your Name"` - Set name for attribution in generated images
98
- - `sb user email "foo@example.com"` - Set email for attribution in generated images
99
- - `sb user analytics <on|off>` - Turn analytics collection on/off
100
- - `sb user reinit` - Configure starbash via a brief guided process
101
-
102
- ### Selection & Filtering
103
- - `sb select` - Show information about the current selection
104
- - `sb select list` - List sessions (filtered based on the current selection)
105
- - `sb select any` - Remove all filters (select everything)
106
- - `sb select target <TARGETNAME>` - Limit selection to the named target
107
- - `sb select telescope <TELESCOPENAME>` - Limit selection to the named telescope
108
- - `sb select date <after|before|between> <DATE> [DATE]` - Limit to sessions in the specified date range
109
- - `sb select export SESSIONNUM DESTDIR` - Export the images for indicated session number into the specified directory (or current directory if not specified). If possible symbolic links are used, if not the files are copied.
110
-
111
- ### Selection information
112
- - `sb info` - Show user preferences location and other app info
113
- - `sb info target` - List targets (filtered based on the current selection)
114
- - `sb info telescope` - List instruments (filtered based on the current selection)
115
- - `sb info filter` - List all filters found in current selection
116
-
117
- ## Not yet supported commands
118
-
119
- ### Export & Processing
120
- - `sb process siril [--run] SESSIONNUM DESTDIR` - Generate Siril directory tree and optionally run Siril GUI
121
- - `sb process auto [SESSIONNUM]` - Automatic processing. If session # is specified process only that session, otherwise all selected sessions will be processed
122
- - `sb process masters` - Generate master flats, darks, and biases from available raw frames in the current selection
123
-
124
- ## Supported tools (now)
125
-
126
- * Siril
127
- * Graxpert
128
- * Python (you can add python code to recipes if necessary)
129
-
130
- ## Supported tools (future?)
131
-
132
- * Pixinsight?
133
- * Autostakkert?
134
-
135
- ## Developing
136
-
137
- We try to make this project useful and friendly. If you find problems please file a github issue.
138
- We accept pull-requests and enjoy discussing possible new development directions via github issues. If you might want to work on this, just describe what your interests are and we can talk about how to get it merged.
139
-
140
- Project members can access crash reports [here](https://geeksville.sentry.io/insights/projects/starbash/?project=4510264204132352).
141
-
142
- ## License
143
-
144
- Copyright 2025 Kevin Hester, kevinh@geeksville.com.
145
- Licensed under the (GPL v3)[LICENSE]
@@ -1,37 +0,0 @@
1
- repo/__init__.py,sha256=St2udJPFek-KwjagkH23h8kBYJHyIXrXjQJpL2Vjz_s,229
2
- repo/manager.py,sha256=4QEt4oRzlTcf75Q7gALBFhtZS_JXOJF6apnSYozRC5c,4812
3
- repo/repo.py,sha256=7EgzEDzTDuluGFbGHLz_-tracze4jPuzerXJpjUaDKU,10680
4
- starbash/__init__.py,sha256=0kEchneSvvuKV334VwULs3UZSIJ9Edsfvawuq39LJmo,1146
5
- starbash/analytics.py,sha256=XYe7PN-pymXmmv8x1C2mUV_wecTnY9gHjczUv3fjSo8,4346
6
- starbash/app.py,sha256=BnuPzM3aBROveMbx0SFkfDMm_ItLJUstEmEWspJOKs0,34168
7
- starbash/commands/__init__.py,sha256=sapJ5w5PFGUfmXtUA1bGIFTr0_gf91Gw6rgCcmzmjUw,706
8
- starbash/commands/info.py,sha256=PNiCdvKocQCAeIMFKYtMsx6PmGnTcxsto8yA3kNvnxo,4131
9
- starbash/commands/process.py,sha256=c5fsLX0sZRzC_8baT2aZYOpqN57jttL5YEvSJH_U3LU,5236
10
- starbash/commands/repo.py,sha256=lelqdo8t6sGvXw9V6ax77P6l7U6z-N4nlc_6RzuOaWQ,7623
11
- starbash/commands/select.py,sha256=_D4FNVnqIYUCWcLYSIYaHDCMccQBPJ3mAVHgqk6Nkr8,14493
12
- starbash/commands/user.py,sha256=MIJFhhWokoaBiZ6rKqQaSVxSvO_glwG5dTGhaZy-6PA,4249
13
- starbash/database.py,sha256=Rno00XGukunS5bTT5SqrEQudUhgXcP0jyvJK1hy_cU0,23058
14
- starbash/defaults/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- starbash/defaults/starbash.toml,sha256=tDF3YFs7JrkZhF2Z1jHQLHR3-4iKSAU7PAeVG9SafZ4,2246
16
- starbash/main.py,sha256=DdeV_w4P__q0sTcGjGUm5hBqIDurq8DUKoDQQaawsfA,1600
17
- starbash/paths.py,sha256=BKKnSXt3tOh16o7ljDcQLtWKIiepEmud9JFtzRwDHtg,1317
18
- starbash/recipes/README.md,sha256=OC0CUAL7xhxujOtEg97vrdNLZmGPLusBeOnwTo5rKN8,317
19
- starbash/recipes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- starbash/recipes/master_bias/starbash.toml,sha256=M06qprFiAhdRubRudHEusrdzNzm7aaqaisjXO7r1tlg,2985
21
- starbash/recipes/master_flat/starbash.toml,sha256=HWZXjXbTiExsC6o5QNr1-5x37PBRo7XNwBEto8Ea-LE,1430
22
- starbash/recipes/osc_dual_duo/starbash.py,sha256=2cI4L6-d50-mL4hY0Oe6ad1v7g18D7ud0Hn0AlHZDOk,5788
23
- starbash/recipes/osc_dual_duo/starbash.toml,sha256=xh3zEqdotRZr7eUcqel-xnQcWH8z-PUFRuWQfLp3F_E,3195
24
- starbash/recipes/osc_single_duo/starbash.toml,sha256=kB-FMek0Z-8vieUfxKqmZMFNnZsSKdufSkLSgH03CkY,2117
25
- starbash/recipes/starbash.toml,sha256=etkMf9iQbEXIKp8GkB05m4jQlnxTqTsDT8MtSJaBSR8,1173
26
- starbash/selection.py,sha256=vsup4XDsch0Z6aGLO9pgcGGgku0xCWfUgk49lRWr9_g,10826
27
- starbash/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- starbash/templates/repo/master.toml,sha256=c53CXMdIPlw9E50LRabgHfyn2qOS0dhz7nmXBx0ETQA,392
29
- starbash/templates/userconfig.toml,sha256=4bpUQ5WlA2Ebbl6c5QxmS2-SXV4IxmN3-H9IghepQEQ,1459
30
- starbash/toml.py,sha256=aNuCqsQ33HYDpWgr_9vpDpd80h2vOU2-kBQmkUqri7c,783
31
- starbash/tool.py,sha256=mBRvSwr2Z96YSBwBgYNrQqj83La97yJkBvZhKWvDqfM,11533
32
- starbash/url.py,sha256=lorxQJ27jSfzsKCb0QvpcvLiPZG55Dkd_c1JPFbni4I,402
33
- starbash-0.1.9.dist-info/METADATA,sha256=IjkplSkTM32SsUOEA1V0791t6S-EDSqiEeglAiB53IM,7716
34
- starbash-0.1.9.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
35
- starbash-0.1.9.dist-info/entry_points.txt,sha256=REQyWs8e5TJsNK7JVVWowKVoytMmKlUwuFHLTmSX4hc,67
36
- starbash-0.1.9.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
37
- starbash-0.1.9.dist-info/RECORD,,