starbash 0.1.11__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 (43) 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 +49 -4
  6. starbash/analytics.py +3 -2
  7. starbash/app.py +287 -565
  8. starbash/check_version.py +18 -0
  9. starbash/commands/__init__.py +2 -1
  10. starbash/commands/info.py +26 -21
  11. starbash/commands/process.py +76 -24
  12. starbash/commands/repo.py +25 -68
  13. starbash/commands/select.py +140 -148
  14. starbash/commands/user.py +88 -23
  15. starbash/database.py +41 -27
  16. starbash/defaults/starbash.toml +1 -0
  17. starbash/exception.py +21 -0
  18. starbash/main.py +29 -7
  19. starbash/paths.py +23 -9
  20. starbash/processing.py +724 -0
  21. starbash/recipes/README.md +3 -0
  22. starbash/recipes/master_bias/starbash.toml +4 -1
  23. starbash/recipes/master_dark/starbash.toml +0 -1
  24. starbash/recipes/osc.py +190 -0
  25. starbash/recipes/osc_dual_duo/starbash.toml +31 -34
  26. starbash/recipes/osc_simple/starbash.toml +82 -0
  27. starbash/recipes/osc_single_duo/starbash.toml +51 -32
  28. starbash/recipes/seestar/starbash.toml +82 -0
  29. starbash/recipes/starbash.toml +8 -9
  30. starbash/selection.py +29 -38
  31. starbash/templates/repo/master.toml +7 -3
  32. starbash/templates/repo/processed.toml +7 -2
  33. starbash/templates/userconfig.toml +9 -0
  34. starbash/toml.py +13 -13
  35. starbash/tool.py +186 -149
  36. starbash-0.1.15.dist-info/METADATA +216 -0
  37. starbash-0.1.15.dist-info/RECORD +45 -0
  38. starbash/recipes/osc_dual_duo/starbash.py +0 -147
  39. starbash-0.1.11.dist-info/METADATA +0 -147
  40. starbash-0.1.11.dist-info/RECORD +0 -40
  41. {starbash-0.1.11.dist-info → starbash-0.1.15.dist-info}/WHEEL +0 -0
  42. {starbash-0.1.11.dist-info → starbash-0.1.15.dist-info}/entry_points.txt +0 -0
  43. {starbash-0.1.11.dist-info → starbash-0.1.15.dist-info}/licenses/LICENSE +0 -0
@@ -1,3 +1,6 @@
1
1
  This is what a typical directory of recipes would look like. it could be hosted locally in a directory tree, on github, whatever.
2
2
 
3
3
  Currently it lives in the starbash python blob, but eventually the 'master' set of recipes will live in a different repo. In fact, different orgs could provide their own recipe repos.
4
+
5
+ FIXME:
6
+ For the time being we also have a few python scripts - until they are refactored a bit so they can live in the http tree.
@@ -34,10 +34,13 @@ input.required = 2 # siril needs at least 2 frames to stack
34
34
  output.dest = "repo" # write to a particular repo
35
35
  output.type = "master" # write output to the special masters repo
36
36
 
37
+
38
+ # context.target - the name of the target (m31 etc...) we are processing (if available)
37
39
  # the following fields will be auto populated in the context before entry:
38
40
  # context.output.base_path - the full filepath to write the output file to **excluding the suffix**
39
41
  # context.output.full_path - the full filepath to write the output file to (including suffix)
40
- # (NOT implemented / needed) context.output.root_path - points to the base of the destination repo
42
+ # context.output.repo - points to the destination repo object
43
+ # context.output.relative_base_path - the relative path within the repo (excluding suffix) (for logging/user message purposes)
41
44
  # (NOT implemented / needed) context.output.suffix - the suffix to append to the output file (e.g. .fits or .fit.gz)
42
45
 
43
46
  # The following constants are auto defined before running the tool
@@ -12,7 +12,6 @@ author.email = "FIXMESiril?"
12
12
  description = "Generate master dark"
13
13
 
14
14
  tool.name = "siril"
15
- tool.timeout = 30
16
15
 
17
16
  input.type = "dark"
18
17
 
@@ -0,0 +1,190 @@
1
+ # pyright: reportUndefinedVariable=false
2
+
3
+
4
+ import logging
5
+ import os
6
+ from glob import glob
7
+ from typing import Any
8
+
9
+ from starbash.processing import NotEnoughFilesError
10
+ from starbash.tool import tools
11
+
12
+ siril = tools["siril"]
13
+
14
+ delete_temps = False
15
+
16
+ # ('context' and 'logger' are normally injected by the starbash runtime)
17
+ context: dict[str, Any] = {}
18
+ logger: logging.Logger = None # type: ignore
19
+
20
+
21
+ # FIXME move this into main starbash
22
+ def perhaps_delete_temps(temps: list[str]) -> None:
23
+ if delete_temps:
24
+ for t in temps:
25
+ for path in glob(f"{context['process_dir']}/{t}_*"):
26
+ os.remove(path)
27
+
28
+
29
+ def make_stacked(variant: str | None, output_file: str):
30
+ """
31
+ Registers and stacks all pre-processed light frames for a given filter configuration
32
+ across all sessions.
33
+ """
34
+ # If we are being invoked for simple/non duo filter we won't have variants generated by prior steps in the workflow
35
+ if variant is None:
36
+ input_base = "bkg_pp_light"
37
+ else:
38
+ input_base = f"{variant}_bkg_pp_light"
39
+
40
+ # The sequence name for all frames of this variant across all sessions
41
+ # e.g. Ha_bkg_pp_light_cHaOiii
42
+ merged_seq_base = f"all_{input_base}"
43
+
44
+ # Absolute path for the output stacked file
45
+ stacked_output_path = glob(f"{context['process_dir']}/{output_file}.fit*")
46
+
47
+ if stacked_output_path:
48
+ logger.info(f"Using existing stacked file: {stacked_output_path}")
49
+ else:
50
+ # Merge all frames (from multiple sessions and configs) use those for stacking
51
+ frames = glob(f"{context['process_dir']}/{input_base}_s*.fit*")
52
+
53
+ logger.info(
54
+ f"Registering and stacking {len(frames)} frames for {variant} -> {stacked_output_path}"
55
+ )
56
+ if len(frames) < 2:
57
+ raise NotEnoughFilesError("Need at least two frames", frames)
58
+
59
+ # Siril commands for registration and stacking. We run this in process_dir.
60
+ commands = f"""
61
+ link {merged_seq_base} -out={context["process_dir"]}
62
+ cd {context["process_dir"]}
63
+
64
+ # We use -2pass to select the best possible reference frame for others to register against
65
+ register {merged_seq_base} -2pass
66
+
67
+ # because we are using -2pass we must complete the registration here before stacking
68
+ # FIXME make drizzle optional
69
+ seqapplyreg {merged_seq_base} -drizzle
70
+
71
+ stack r_{merged_seq_base} rej g 0.3 0.05 -filter-wfwhm=3k -norm=addscale -output_norm -32b -out={output_file}
72
+
73
+ # and flip if required
74
+ mirrorx_single {output_file}
75
+ """
76
+
77
+ context["input_files"] = frames
78
+ siril.run(commands, context=context)
79
+
80
+ perhaps_delete_temps([merged_seq_base, f"r_{merged_seq_base}"])
81
+
82
+
83
+ def make_renormalize(channel_num: int):
84
+ """
85
+ Aligns the stacked images (Sii, Ha, OIII) and renormalizes Sii and OIII
86
+ to match the flux of the Ha channel.
87
+ """
88
+ logger.info("Aligning and renormalizing stacked images.")
89
+
90
+ # Define file basenames for the stacked images created in the 'process' directory
91
+ ha_base = "results_00001"
92
+ oiii_base = "results_00002"
93
+ sii_base = "results_00003"
94
+
95
+ # Define final output paths. The 'results' directory is a symlink in the work dir.
96
+ results_dir = context["output"]["base_path"]
97
+ os.makedirs(results_dir, exist_ok=True)
98
+
99
+ commands = ""
100
+
101
+ if channel_num == 1:
102
+ # Only one channel - just copy it - eventually we'll add other metadata
103
+ final_path = f"{results_dir}/stacked.fits"
104
+ commands += f"""
105
+ load results_00001
106
+ save "{final_path}"
107
+ """
108
+
109
+ # Basenames for registered files (output of 'register' command)
110
+ r_ha = f"r_{ha_base}"
111
+ r_oiii = f"r_{oiii_base}"
112
+
113
+ if channel_num >= 2:
114
+ # Do pixelmath to fixup channel brightness
115
+ logger.info("Doing renormalisation of extra Ha/Oiii channels")
116
+
117
+ ha_final_path = f"{results_dir}/stacked_Ha.fits"
118
+ oiii_final_path = f"{results_dir}/stacked_OIII.fits"
119
+
120
+ # Pixel math formula for renormalization.
121
+ # It matches the median and spread (MAD) of a channel to a reference channel (Ha).
122
+ # Formula: new = old * (MAD(ref)/MAD(old)) - (MAD(ref)/MAD(old)) * MEDIAN(old) + MEDIAN(ref)
123
+ pm_oiii = f'"${r_oiii}$*mad(${r_ha}$)/mad(${r_oiii}$)-mad(${r_ha}$)/mad(${r_oiii}$)*median(${r_oiii}$)+median(${r_ha}$)"'
124
+
125
+ # Siril commands to be executed in the 'process' directory
126
+ commands += f"""
127
+ # -transf=shift fails sometimes, which I guess is possible because we have multiple sessions with possible different camera rotation
128
+ # -interp=none also fails sometimes, so let default interp happen
129
+ # -drizzle is required for success on many images
130
+ register results -drizzle
131
+ pm {pm_oiii}
132
+ update_key FILTER Oiii "OSC Duo filter extracted"
133
+ save "{oiii_final_path}"
134
+ load {r_ha}
135
+ update_key FILTER Ha "OSC Duo filter extracted"
136
+ save "{ha_final_path}"
137
+ """
138
+
139
+ if channel_num >= 3:
140
+ logger.info("Doing renormalisation of extra Sii channel")
141
+
142
+ sii_final_path = f"{results_dir}/stacked_Sii.fits"
143
+ r_sii = f"r_{sii_base}"
144
+ pm_sii = f'"${r_sii}$*mad(${r_ha}$)/mad(${r_sii}$)-mad(${r_ha}$)/mad(${r_sii}$)*median(${r_sii}$)+median(${r_ha}$)"'
145
+ commands += f"""
146
+ pm {pm_sii}
147
+ update_key FILTER Sii "OSC dual Duo filter extracted"
148
+ save "{sii_final_path}"
149
+ """
150
+
151
+ siril.run(commands, context=context, cwd=context["process_dir"])
152
+ logger.info(f"Saved final renormalized images to {results_dir}")
153
+
154
+
155
+ def osc_process(has_ha_oiii: bool, has_sii_oiii: bool):
156
+ """Shared code for use by OSC processing scripts"""
157
+
158
+ logger.info(f"Running osc_process(has_ha_oiii={has_ha_oiii}, has_sii_oiii={has_sii_oiii})")
159
+ logger.debug("Using context: %s", context)
160
+
161
+ channel_num = 0
162
+ if has_sii_oiii:
163
+ # red output channel - from the SiiOiii filter Sii is on the 672nm red channel (mistakenly called Ha by siril)
164
+ channel_num += 1
165
+ make_stacked("Ha", f"results_{channel_num:05d}")
166
+
167
+ if has_ha_oiii:
168
+ # green output channel - from the HaOiii filter Ha is on the 656nm red channel
169
+ channel_num += 1
170
+ make_stacked("Ha", f"results_{channel_num:05d}")
171
+
172
+ if has_ha_oiii or has_sii_oiii:
173
+ # blue output channel - both filters have Oiii on the 500nm blue channel. Note the case here is uppercase to match siril output
174
+ channel_num += 1
175
+ make_stacked("OIII", f"results_{channel_num:05d}")
176
+
177
+ # if we haven't already processed some other way - just do a single channel process
178
+ # FIXME in this case we want to use a siril line like "stack r_bkg_pp_light rej g 0.3 0.05 -filter-wfwhm=3k -norm=addscale -output_norm -rgb_equal -32b -out=result"
179
+ if channel_num == 0:
180
+ # single channel - just stack all Ha frames together
181
+ channel_num += 1
182
+ make_stacked(None, f"results_{channel_num:05d}")
183
+
184
+ # There might be an old/state autogenerated .seq file, delete it so it doesn't confuse renormalize
185
+ results_seq_path = f"{context['process_dir']}/results_.seq"
186
+ if os.path.exists(results_seq_path):
187
+ os.remove(results_seq_path)
188
+
189
+ assert channel_num >= 1, "At least one channel should have been processed"
190
+ make_renormalize(channel_num)
@@ -3,8 +3,12 @@
3
3
  kind = "recipe"
4
4
 
5
5
  [recipe]
6
- author.name = "Kevin Hester"
7
- author.email = "kevinh@geeksville.com"
6
+ author.name = "FIXMEsirilsomeone"
7
+ author.email = "FIXMEsirilsomeone"
8
+
9
+ # Lower priority recipes are tried to match first
10
+ # - we want this to match after the osc_dual_duo has a chance
11
+ priority = 10
8
12
 
9
13
  # FIXME-somehow-specify-what-filternames are used to auto detect this recipe can be used?
10
14
  # figure out how to support dual duo vs single duo. Perhaps: the FIRST recipe that matches an auto rule
@@ -17,7 +21,9 @@ author.email = "kevinh@geeksville.com"
17
21
  auto.require.filter = ["SiiOiii"]
18
22
  # for single duo look for this
19
23
  # auto.require.filter = ["HaOiii"]
20
- auto.require.camera = ["OSC"]
24
+
25
+ # To require a color camera use this. or to require a mono camera auto.require.mono.
26
+ auto.require.color = true
21
27
 
22
28
  # all sb.toml files can optionally contain a version section. if version of the running starbash app is out of bounds a warning message will be printed
23
29
  # to the user and the file will be ignored for future processing.
@@ -32,21 +38,19 @@ description = "Extract OSC dual duo filter Ha, Oiii and Sii channels"
32
38
 
33
39
  tool.name = "siril"
34
40
 
35
- when = "session.light" # run once per session.config
41
+ # Auto find input light frames for the current session
42
+ # Look for files in input repos, finding them by using the "relative" tag they contain
43
+ input.source = "repo"
44
+ input.required = 2 # siril needs at least 2 frames to stack
45
+ input.type = "light" # look in all raw repos, but look only for light files
36
46
 
47
+ # Auto find suitable masters of the following type
37
48
  input.masters = ["bias", "flat"]
38
49
 
39
- # FIXME, bias and flat should have been added to context by two previous stages. But for now hardwire
40
- # Note: they should not have filename extensions (see strip_extension in the old process.py)
41
- # context.bias = '/workspaces/starbash/images/masters/biases/2025-09-09_stacked.fits'
50
+ # the base name for our light files
51
+ context.light_base = '''light_s{session["id"]}'''
42
52
 
43
- # context.sessionid = "2025-09-16" # FIXME, generate this by looping over all sessions (from outside this file)
44
- # context.sessionconfig = "SiiOiii" # FIXME generate this by looping over all session configs
45
- # context.light_base = "light_s{sessionid}_c{sessionconfig}"
46
53
 
47
- # FIXME until auto light finding is in
48
- # input.source = "path"
49
- # input.path = "/workspaces/starbash/images/from_astroboy/M 27/2025-09-16/LIGHT/*.fit*"
50
54
 
51
55
  script = '''
52
56
  # Create a sequence from the raw light frames, seq file goes to process_dir
@@ -54,7 +58,7 @@ script = '''
54
58
  cd {process_dir}
55
59
 
56
60
  # Calibrate the light frames using master bias and flat
57
- calibrate {light_base} -bias={bias} -flat=flat -cfa -equalize_cfa
61
+ calibrate {light_base} -bias={master["bias"]} -flat={master["flat"]} -cfa -equalize_cfa
58
62
 
59
63
  # Remove background gradient on a per-frame basis (generates bkg_pp_light.seq)
60
64
  seqsubsky pp_{light_base} 1
@@ -63,39 +67,32 @@ script = '''
63
67
  seqextract_HaOIII bkg_pp_{light_base} -resample=ha
64
68
  '''
65
69
 
66
- temporaries = ["FIXME"]
70
+ # temporaries = ["FIXME"]
67
71
 
68
72
  [recipe.stage.stack]
69
73
 
70
- disabled = false # not yet ready to test
71
-
72
- # FIXME this stage should only be considered if the previous stage in this same array
74
+ # this stage is considered if the previous stage in this same array
73
75
  # was run. It must be run inside the same tempdir (so that files from previous stage are available)
74
76
 
75
- # FIXME, eventually we could make it optional to even have a starbash.toml. If we find an
76
- # starbash.py we could introspect it for a starbash_config dict. And look inside that for description
77
- # "stage", "when" or whatever?
77
+ description = "Stack OSC dual duo (HaOiii + SiiOiii) filter data: with separate Ha, Oiii and Sii channels"
78
78
 
79
- description = "Stack OSC dual duo filter data, with separate Ha, Oiii and Sii channels"
80
-
81
- # context.target = "M 27" # FIXME
82
- # context.targets = "/workspaces/starbash/images/processed" # FIXME, do something smarter
79
+ input.source = "recipe" # we will use output files from previous stages in this same recipe as our input
83
80
 
84
81
  tool.name = "python"
85
82
 
86
- when = "final.stack" # run once after all session/session.config processing was done
87
-
88
83
  # Based on the following definitions in the stage toml file...
89
84
  # FIXME, we should inherit this - most recipes shouldn't have to declare it
90
85
  output.dest = "repo" # write to a particular repo
91
- output.type = "processed" # write output to the special masters repo
86
+ output.type = "processed" # write output to the special processed repo
92
87
 
93
88
  # if not specified starbash.py used
94
89
  # script-file = "script.py"
95
90
 
96
- # or inline python code instead of that function?
97
- #script = '''
98
- # make_stacked("SiiOiii", "Ha", f"results_00001")
99
- # ...
100
- # (moved to script.py)
101
- # '''
91
+ # or inline python code can be provided here. In this case I'm using some python
92
+ # code I'm temporarily sharing from the main project...
93
+ script = '''
94
+ from starbash.recipes import osc
95
+ osc.logger = logger
96
+ osc.context = context
97
+ osc.osc_process(has_ha_oiii=True, has_sii_oiii=True)
98
+ '''
@@ -0,0 +1,82 @@
1
+
2
+ [repo]
3
+ kind = "recipe"
4
+
5
+ [recipe]
6
+
7
+ # Lower priority recipes are tried to match first
8
+ # - we want this to match after the osc_dual_duo has a chance
9
+ priority = 30
10
+
11
+ author.name = "FIXMEsirilsomeone"
12
+ author.email = "FIXMEsirilsomeone"
13
+
14
+ # no filter requirements - will work for any osc session
15
+ auto.require.color = true
16
+
17
+ # all sb.toml files can optionally contain a version section. if version of the running starbash app is out of bounds a warning message will be printed
18
+ # to the user and the file will be ignored for future processing.
19
+ [recipe.require.version]
20
+ min="0.1.0"
21
+ max="4.5.8"
22
+
23
+ [recipe.stage.light]
24
+
25
+ description = "Calibrate OSC frames vs bias and flats"
26
+ # disabled = true # FIXME, debugging later stuff
27
+
28
+ tool.name = "siril"
29
+
30
+ # Auto find input light frames for the current session
31
+ # Look for files in input repos, finding them by using the "relative" tag they contain
32
+ input.source = "repo"
33
+ input.required = 2 # siril needs at least 2 frames to stack
34
+ input.type = "light" # look in all raw repos, but look only for light files
35
+
36
+ # Auto find suitable masters of the following type
37
+ input.masters = ["bias", "flat"]
38
+
39
+ # the base name for our light files
40
+ context.light_base = '''light_s{session["id"]}'''
41
+
42
+ script = '''
43
+ # Create a sequence from the raw light frames, seq file goes to process_dir
44
+ link {light_base} -out={process_dir}
45
+ cd {process_dir}
46
+
47
+ # Calibrate the light frames using master bias and flat
48
+ calibrate {light_base} -bias={master["bias"]} -flat={master["flat"]} -cfa -equalize_cfa
49
+
50
+ # Remove background gradient on a per-frame basis (generates bkg_pp_light.seq)
51
+ seqsubsky pp_{light_base} 1
52
+ '''
53
+
54
+ # temporaries = ["FIXME"]
55
+
56
+ [recipe.stage.stack]
57
+
58
+ # this stage is only be considered if the previous stage in this same array
59
+ # was run. It must be run inside the same tempdir (so that files from previous stage are available)
60
+
61
+ description = "Stack OSC simple (non duo filter) images"
62
+
63
+ input.source = "recipe" # we will use output files from previous stages in this same recipe as our input
64
+
65
+ tool.name = "python"
66
+
67
+ # Based on the following definitions in the stage toml file...
68
+ # FIXME, we should inherit this - most recipes shouldn't have to declare it
69
+ output.dest = "repo" # write to a particular repo
70
+ output.type = "processed" # write output to the special processed repo
71
+
72
+ # if not specified starbash.py used
73
+ # script-file = "script.py"
74
+
75
+ # or inline python code can be provided here. In this case I'm using some python
76
+ # code I'm temporarily sharing from the main project...
77
+ script = '''
78
+ from starbash.recipes import osc
79
+ osc.logger = logger
80
+ osc.context = context
81
+ osc.osc_process(has_ha_oiii=False, has_sii_oiii=False)
82
+ '''
@@ -2,30 +2,43 @@
2
2
  [repo]
3
3
  kind = "recipe"
4
4
 
5
+ [recipe]
6
+
7
+ # Lower priority recipes are tried to match first
8
+ # - we want this to match after the osc_dual_duo has a chance
9
+ priority = 20
10
+
11
+ author.name = "FIXMEsirilsomeone"
12
+ author.email = "FIXMEsirilsomeone"
13
+
14
+ # for single duo look for this
15
+ auto.require.filter = ["HaOiii"]
16
+ auto.require.color = true
17
+
5
18
  # all sb.toml files can optionally contain a version section. if version of the running starbash app is out of bounds a warning message will be printed
6
19
  # to the user and the file will be ignored for future processing.
7
20
  [recipe.require.version]
8
21
  min="0.1.0"
9
22
  max="4.5.8"
10
23
 
11
- [recipe]
12
- author.name = "Kevin Hester"
13
- author.email = "kevinh@geeksville.com"
24
+ [recipe.stage.light]
14
25
 
15
- [[stage]]
26
+ description = "Extract OSC dual duo filter Ha, Oiii and Sii channels"
27
+ # disabled = true # FIXME, debugging later stuff
16
28
 
17
- description = "Process OSC single duo filter data, extracting Ha and Oiii"
29
+ tool.name = "siril"
18
30
 
19
- disabled = true # FIXME, we don't yet have auto selection based on filter types
31
+ # Auto find input light frames for the current session
32
+ # Look for files in input repos, finding them by using the "relative" tag they contain
33
+ input.source = "repo"
34
+ input.required = 2 # siril needs at least 2 frames to stack
35
+ input.type = "light" # look in all raw repos, but look only for light files
20
36
 
21
- # Restrict processing of this stage to only if detected hardware was found for this session
22
- # for single duo look for this
23
- auto.for-filter = ["HaOiii"]
24
- auto.for-camera = ["OSC"]
37
+ # Auto find suitable masters of the following type
38
+ input.masters = ["bias", "flat"]
25
39
 
26
- tool.name = "siril"
27
- when = "session.light" # run once per session.config
28
- output = "FIXME"
40
+ # the base name for our light files
41
+ context.light_base = '''light_s{session["id"]}'''
29
42
 
30
43
  script = '''
31
44
  # Create a sequence from the raw light frames, seq file goes to process_dir
@@ -33,35 +46,41 @@ script = '''
33
46
  cd {process_dir}
34
47
 
35
48
  # Calibrate the light frames using master bias and flat
36
- calibrate {light_base} -bias={bias} -flat={flat} -cfa -equalize_cfa
49
+ calibrate {light_base} -bias={master["bias"]} -flat={master["flat"]} -cfa -equalize_cfa
37
50
 
38
- # Remove background gradient on a per-frame basis (generates bkg_pp_{light_base}.seq)
51
+ # Remove background gradient on a per-frame basis (generates bkg_pp_light.seq)
39
52
  seqsubsky pp_{light_base} 1
53
+
54
+ # FIXME only do this step for duo filters (refactor to share common light processing function)
55
+ seqextract_HaOIII bkg_pp_{light_base} -resample=ha
40
56
  '''
41
57
 
42
- temporaries = ["FIXME"]
58
+ # temporaries = ["FIXME"]
43
59
 
44
- [[stage]]
60
+ [recipe.stage.stack]
45
61
 
46
- disabled = true # FIXME, we don't yet have auto selection based on filter types
62
+ # this stage is only be considered if the previous stage in this same array
63
+ # was run. It must be run inside the same tempdir (so that files from previous stage are available)
47
64
 
48
- tool.name = "python"
49
- when = "session.stack" # run once after all session/session.config processing was done
65
+ description = "Stack OSC single duo filter data: with Ha, Oiii extraction"
50
66
 
51
- script-file = "script.py"
67
+ input.source = "recipe" # we will use output files from previous stages in this same recipe as our input
52
68
 
53
- # or inline python code instead of that function?
54
- script = '''
55
- # green output channel - from the HaOiii filter Ha is on the 656nm red channel
56
- make_stacked("HaOiii", "Ha", f"results_00001")
69
+ tool.name = "python"
57
70
 
58
- # blue output channel - both filters have Oiii on the 500nm blue channel. Note the case here is uppercase to match siril output
59
- make_stacked("*", "OIII", f"results_00002")
71
+ # Based on the following definitions in the stage toml file...
72
+ # FIXME, we should inherit this - most recipes shouldn't have to declare it
73
+ output.dest = "repo" # write to a particular repo
74
+ output.type = "processed" # write output to the special processed repo
60
75
 
61
- # There might be an old/state autogenerated .seq file, delete it so it doesn't confuse renormalize
62
- results_seq_path = f"{process_dir}/results_.seq"
63
- if os.path.exists(results_seq_path):
64
- os.remove(results_seq_path)
76
+ # if not specified starbash.py used
77
+ # script-file = "script.py"
65
78
 
66
- make_renormalize()
79
+ # or inline python code can be provided here. In this case I'm using some python
80
+ # code I'm temporarily sharing from the main project...
81
+ script = '''
82
+ from starbash.recipes import osc
83
+ osc.logger = logger
84
+ osc.context = context
85
+ osc.osc_process(has_ha_oiii=True, has_sii_oiii=False)
67
86
  '''
@@ -0,0 +1,82 @@
1
+
2
+ [repo]
3
+ kind = "recipe"
4
+
5
+ [recipe]
6
+
7
+ # Lower priority recipes are tried to match first
8
+ # - we want to match this before all other color cameras (because we need special processing)
9
+ priority = 5
10
+
11
+ author.name = "FIXMEsirilsomeone"
12
+ author.email = "FIXMEsirilsomeone"
13
+
14
+ # no filter requirements - will work for any osc session
15
+ auto.require.camera = ["Seestar"]
16
+ auto.require.color = true
17
+
18
+ # all sb.toml files can optionally contain a version section. if version of the running starbash app is out of bounds a warning message will be printed
19
+ # to the user and the file will be ignored for future processing.
20
+ [recipe.require.version]
21
+ min="0.1.0"
22
+ max="4.5.8"
23
+
24
+ [recipe.stage.light]
25
+
26
+ description = "Fix background gradient on Seestar frames"
27
+ # disabled = true # FIXME, debugging later stuff
28
+
29
+ tool.name = "siril"
30
+
31
+ # Auto find input light frames for the current session
32
+ # Look for files in input repos, finding them by using the "relative" tag they contain
33
+ input.source = "repo"
34
+ input.required = 2 # siril needs at least 2 frames to stack
35
+ input.type = "light" # look in all raw repos, but look only for light files
36
+
37
+ # We don't require any masters for seestar processing
38
+ input.masters = []
39
+
40
+ # the base name for our light files
41
+ context.light_base = '''light_s{session["id"]}'''
42
+
43
+ script = '''
44
+ # Create a sequence from the raw light frames, seq file goes to process_dir
45
+ link pp_{light_base} -out={process_dir}
46
+ cd {process_dir}
47
+
48
+ # No calibration needed for seestar frames - it was done in camera
49
+
50
+ # Remove background gradient on a per-frame basis (generates bkg_pp_light.seq)
51
+ seqsubsky pp_{light_base} 1
52
+ '''
53
+
54
+ # temporaries = ["FIXME"]
55
+
56
+ [recipe.stage.stack]
57
+
58
+ # this stage is only be considered if the previous stage in this same array
59
+ # was run. It must be run inside the same tempdir (so that files from previous stage are available)
60
+
61
+ description = "Stack OSC simple (non duo filter) images"
62
+
63
+ input.source = "recipe" # we will use output files from previous stages in this same recipe as our input
64
+
65
+ tool.name = "python"
66
+
67
+ # Based on the following definitions in the stage toml file...
68
+ # FIXME, we should inherit this - most recipes shouldn't have to declare it
69
+ output.dest = "repo" # write to a particular repo
70
+ output.type = "processed" # write output to the special processed repo
71
+
72
+ # if not specified starbash.py used
73
+ # script-file = "script.py"
74
+
75
+ # or inline python code can be provided here. In this case I'm using some python
76
+ # code I'm temporarily sharing from the main project...
77
+ script = '''
78
+ from starbash.recipes import osc
79
+ osc.logger = logger
80
+ osc.context = context
81
+ osc.osc_process(has_ha_oiii=False, has_sii_oiii=False)
82
+ '''
@@ -21,12 +21,11 @@ dir = "osc_dual_duo"
21
21
  [[repo-ref]]
22
22
  dir = "osc_single_duo"
23
23
 
24
- # processing stages, currently all declared here, but possibly in the future they could be added by user/other toml files
24
+ [[repo-ref]]
25
+ dir = "osc_simple"
25
26
 
26
- # Not included in standard list - for now we run manually
27
- #[[stages]]
28
- #name = "setup-masters" # for flat processing, master generation etc
29
- #priority = 5
27
+ [[repo-ref]]
28
+ dir = "seestar"
30
29
 
31
30
  #
32
31
  # master specific stages
@@ -34,7 +33,7 @@ dir = "osc_single_duo"
34
33
  [[master-stages]]
35
34
  name = "master-bias" # generate master bias frames
36
35
  priority = 10
37
- input = "bias" # only used for frames of this type
36
+ input = "bias" # only used for frames of this type
38
37
 
39
38
  [[master-stages]]
40
39
  name = "master-dark" # generate master dark frames
@@ -47,8 +46,8 @@ priority = 20
47
46
  input = "flat"
48
47
 
49
48
  #
50
- # session specific processing stages, not currently used, for now I just do this list from code
51
- #
49
+ # session specific processing stages
50
+ # FIXME - we are not using this yet, for now we just hardcode in app.py
52
51
 
53
52
  [[stages]]
54
53
  name = "light" # generate light frames from lights and with reference to flats/bias
@@ -58,4 +57,4 @@ input = "light" # only used for frames of this type
58
57
  [[stages]]
59
58
  name = "stack" # stack frames
60
59
  priority = 30
61
- input = "light" # only used for frames of this type
60
+ input = "recipe" # use output from previous stages in the same recipe