Skip to content

Commit 7a4e5fb

Browse files
authored
Merge pull request #828 from CroatianMeteorNetwork/prerelease
Prerelease update - February 2026
2 parents d2b1eb6 + ff20184 commit 7a4e5fb

19 files changed

Lines changed: 1573 additions & 795 deletions

.config

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ camera_group_name: none
6666
; three arguments: captured_night_dir, archived_night_dir, config
6767
external_script_run: false
6868

69+
; Toggle logging of the external script. If true, logging will be captured by RMS from the external script.
70+
; If false, the script process will have all log handlers removed to prevent interference with its own logging.
71+
external_script_log: false
72+
73+
6974
; Run the external script after auto reprocess.
7075
; "auto_reprocess" needs to be "true" for this to work.
7176
auto_reprocess_external_script_run: false
@@ -365,6 +370,22 @@ win_pc_weave: -Wall
365370
; Flag for enabling/disabling upload to meteor server
366371
upload_enabled: true
367372

373+
; If upload_split is true, two archives will be created.
374+
; One archive, suffix _imgdata, contains the images. The
375+
; other archive, suffix _metadata will only contain the
376+
; data derived from the images, including the timelapse.
377+
;
378+
; The metadata archive is much smaller than the imagedata
379+
; archive, and can be extracted very quickly. This speeds up the
380+
; processing on the server, since the image data is generally not
381+
; required.
382+
383+
; If upload_split is false a single archive will be uploaded
384+
; with the suffix _detected containing all images, and data derived.
385+
; These archives are large and slow down the server side processing.
386+
387+
upload_split: true
388+
368389
; Delay upload for the given number of minutes
369390
upload_delay: 0
370391

@@ -800,3 +821,8 @@ timelapse_generate_from_frames: true
800821
; color palette to use for various charts -can be any matplotlib color scheme
801822
; other options are gist_ncar, rainbow, gist_rainbow, inferno
802823
shower_color_map: gist_ncar
824+
825+
; color to use for plotting sporadics on the radiants map. Can be any matplotlib
826+
; named color: https://matplotlib.org/stable/gallery/color/named_colors.html
827+
; white stands out well but the default is gray.
828+
sporadic_color: gray

README.md

Lines changed: 69 additions & 172 deletions
Large diffs are not rendered by default.

RMS/ArchiveDetections.py

Lines changed: 71 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33

44
import os
5+
import shutil
56
import sys
67
import traceback
78

89

10+
911
from RMS.Formats.FFfile import validFFName
1012
from RMS.Logger import getLogger
1113
from RMS.Misc import archiveDir, tarWithProgress
1214
from RMS.Routines import MaskImage
1315
from Utils.GenerateThumbnails import generateThumbnails
1416
from Utils.StackFFs import stackFFs
17+
from Utils.LogArchiver import makeLogArchives
1518

1619

1720
# Get the logger from the main module
@@ -147,7 +150,13 @@ def archiveFieldsums(dir_path):
147150

148151

149152
def archiveDetections(captured_path, archived_path, ff_detected, config, extra_files=None):
150-
""" Create thumbnails and compress all files with detections and the accompanying files in one archive.
153+
""" Create thumbnails and compress all files with detections and the accompanying files
154+
in one archive, suffix _detected
155+
156+
or
157+
158+
only the fr*.bin, ff*.fits and extra_files in one archive, suffix _imgdata,
159+
and everything apart from fr*.bin and ff*.fits in another archive, suffix _metadata
151160
152161
Arguments:
153162
captured_path: [str] Path where the captured files are located.
@@ -156,18 +165,19 @@ def archiveDetections(captured_path, archived_path, ff_detected, config, extra_f
156165
config: [conf object] Configuration.
157166
158167
Keyword arguments:
159-
extra_files: [list] A list of extra files (with fill paths) which will be be saved to the night
168+
extra_files: [list] A list of extra files (with full paths) which will be saved to the night
160169
archive.
161170
162171
Return:
163172
archive_name: [str] Name of the archive where the files were compressed to.
173+
imgdata_archive_name: [str] Name of the archive where the images were compressed to.
174+
metadata_archive_name: [str] Name of the archive where the metadata was compressed to.
164175
165176
"""
166177

167178
# Get the list of files to archive
168179
file_list = selectFiles(config, captured_path, ff_detected)
169180

170-
171181
log.info('Generating thumbnails...')
172182

173183
try:
@@ -249,21 +259,70 @@ def archiveDetections(captured_path, archived_path, ff_detected, config, extra_f
249259
log.error('Generating stack failed with error:' + repr(e))
250260
log.error("".join(traceback.format_exception(*sys.exc_info())))
251261

262+
log.info("Generating an archive file of most recent logs...")
263+
264+
try:
265+
266+
267+
log_archive_path = makeLogArchives(config, captured_path)
268+
log.info(f"Log archive saved to: {log_archive_path}")
269+
file_list.append(os.path.basename(log_archive_path))
270+
271+
except Exception as e:
272+
log.error('Generating log archives failed with error:' + repr(e))
273+
log.error("".join(traceback.format_exception(*sys.exc_info())))
274+
252275

253276

254277
if file_list:
255278

256279
# Create the archive ZIP in the parent directory of the archive directory
257-
archive_name = os.path.join(os.path.abspath(os.path.join(archived_path, os.pardir)),
258-
os.path.basename(captured_path) + '_detected')
280+
archive_base = os.path.join(os.path.abspath(os.path.join(archived_path, os.pardir)),
281+
os.path.basename(captured_path))
259282

260-
# Archive the files
261-
archive_name = archiveDir(captured_path, file_list, archived_path, archive_name, \
262-
extra_files=extra_files)
283+
# Create the imgdata set which is the union of the sets of FF files and FR files
284+
imgdata_set = (set([item for item in file_list if item.startswith("FF") and item.endswith(".fits")]) |
285+
set([item for item in file_list if item.startswith("FR") and item.endswith(".bin")]))
286+
287+
# Create the metadata set which is all the files from _detected excluding the files in imgdata_set,
288+
# (*.fits and *.bin)
289+
290+
metadata_set = set([item for item in file_list if item not in imgdata_set])
291+
292+
# Create all the required archive names and paths
293+
archive_name = f"{archive_base}_detected"
294+
metadata_archived_path = f"{archived_path}_metadata"
295+
metadata_archive_name = f"{archive_base}_metadata"
296+
imgdata_archived_path = f"{archived_path}_imgdata"
297+
imgdata_archive_name = f"{archive_base}_imgdata"
298+
299+
# In all cases, generate the _detected directory and archive as a record for the station
300+
301+
# Make the archive directory and compress into _detected.tar.bz2 if config.upload_split is False.
302+
303+
create_detected_tar_bz2 = not config.upload_split
304+
archive_name = archiveDir(captured_path, file_list, archived_path, archive_name, extra_files=extra_files,
305+
create_archive=create_detected_tar_bz2)
306+
307+
if config.upload_split:
308+
# Create a directory to hold the metadata files, archive, then remove the directory
309+
metadata_archive_name = archiveDir(captured_path, metadata_set, metadata_archived_path,
310+
metadata_archive_name, extra_files=extra_files, delete_dest_dir=True)
311+
312+
# Create a directory to hold the imgdata files, archive, then remove the directory
313+
imgdata_archive_name = archiveDir(captured_path, imgdata_set, imgdata_archived_path,
314+
imgdata_archive_name, extra_files=extra_files, delete_dest_dir=True)
315+
316+
# Set to archive_name to None to prevent upload from this execution path
317+
archive_name = None
318+
319+
else:
320+
# Set to None, as these archives will not be generated in this path
321+
imgdata_archive_name, metadata_archive_name = None, None
263322

264-
return archive_name
323+
return archive_name, imgdata_archive_name, metadata_archive_name
265324

266-
return None
325+
return None, None, None
267326

268327

269328
def archiveFrameTimelapse(frames_root,
@@ -355,7 +414,7 @@ def archiveFrameTimelapse(frames_root,
355414

356415
ff_detected = ['FF_CA0001_20170905_094707_004_0000000.fits', 'FF_CA0001_20170905_094716_491_0000256.fits']
357416

358-
archive_name = archiveDetections(captured_path, archived_path, ff_detected, config)
417+
archive_name, metadata_name, imgdata_name = archiveDetections(captured_path, archived_path, ff_detected, config)
359418

360-
print(archive_name)
419+
print(archive_name, metadata_name, imgdata_name)
361420

0 commit comments

Comments
 (0)