setiastrosuitepro 1.6.7__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.
Potentially problematic release.
This version of setiastrosuitepro might be problematic. Click here for more details.
- setiastro/__init__.py +2 -0
- setiastro/data/SASP_data.fits +0 -0
- setiastro/data/catalogs/List_of_Galaxies_with_Distances_Gly.csv +488 -0
- setiastro/data/catalogs/astrobin_filters.csv +890 -0
- setiastro/data/catalogs/astrobin_filters_page1_local.csv +51 -0
- setiastro/data/catalogs/cali2.csv +63 -0
- setiastro/data/catalogs/cali2color.csv +65 -0
- setiastro/data/catalogs/celestial_catalog - original.csv +16471 -0
- setiastro/data/catalogs/celestial_catalog.csv +24031 -0
- setiastro/data/catalogs/detected_stars.csv +24784 -0
- setiastro/data/catalogs/fits_header_data.csv +46 -0
- setiastro/data/catalogs/test.csv +8 -0
- setiastro/data/catalogs/updated_celestial_catalog.csv +16471 -0
- setiastro/images/Astro_Spikes.png +0 -0
- setiastro/images/Background_startup.jpg +0 -0
- setiastro/images/HRDiagram.png +0 -0
- setiastro/images/LExtract.png +0 -0
- setiastro/images/LInsert.png +0 -0
- setiastro/images/Oxygenation-atm-2.svg.png +0 -0
- setiastro/images/RGB080604.png +0 -0
- setiastro/images/abeicon.png +0 -0
- setiastro/images/aberration.png +0 -0
- setiastro/images/acv_icon.png +0 -0
- setiastro/images/andromedatry.png +0 -0
- setiastro/images/andromedatry_satellited.png +0 -0
- setiastro/images/annotated.png +0 -0
- setiastro/images/aperture.png +0 -0
- setiastro/images/astrosuite.ico +0 -0
- setiastro/images/astrosuite.png +0 -0
- setiastro/images/astrosuitepro.icns +0 -0
- setiastro/images/astrosuitepro.ico +0 -0
- setiastro/images/astrosuitepro.png +0 -0
- setiastro/images/background.png +0 -0
- setiastro/images/background2.png +0 -0
- setiastro/images/benchmark.png +0 -0
- setiastro/images/big_moon_stabilizer_timeline.png +0 -0
- setiastro/images/big_moon_stabilizer_timeline_clean.png +0 -0
- setiastro/images/blaster.png +0 -0
- setiastro/images/blink.png +0 -0
- setiastro/images/clahe.png +0 -0
- setiastro/images/collage.png +0 -0
- setiastro/images/colorwheel.png +0 -0
- setiastro/images/contsub.png +0 -0
- setiastro/images/convo.png +0 -0
- setiastro/images/copyslot.png +0 -0
- setiastro/images/cosmic.png +0 -0
- setiastro/images/cosmicsat.png +0 -0
- setiastro/images/crop1.png +0 -0
- setiastro/images/cropicon.png +0 -0
- setiastro/images/curves.png +0 -0
- setiastro/images/cvs.png +0 -0
- setiastro/images/debayer.png +0 -0
- setiastro/images/denoise_cnn_custom.png +0 -0
- setiastro/images/denoise_cnn_graph.png +0 -0
- setiastro/images/disk.png +0 -0
- setiastro/images/dse.png +0 -0
- setiastro/images/exoicon.png +0 -0
- setiastro/images/eye.png +0 -0
- setiastro/images/first_quarter.png +0 -0
- setiastro/images/fliphorizontal.png +0 -0
- setiastro/images/flipvertical.png +0 -0
- setiastro/images/font.png +0 -0
- setiastro/images/freqsep.png +0 -0
- setiastro/images/full_moon.png +0 -0
- setiastro/images/functionbundle.png +0 -0
- setiastro/images/graxpert.png +0 -0
- setiastro/images/green.png +0 -0
- setiastro/images/gridicon.png +0 -0
- setiastro/images/halo.png +0 -0
- setiastro/images/hdr.png +0 -0
- setiastro/images/histogram.png +0 -0
- setiastro/images/hubble.png +0 -0
- setiastro/images/imagecombine.png +0 -0
- setiastro/images/invert.png +0 -0
- setiastro/images/isophote.png +0 -0
- setiastro/images/isophote_demo_figure.png +0 -0
- setiastro/images/isophote_demo_image.png +0 -0
- setiastro/images/isophote_demo_model.png +0 -0
- setiastro/images/isophote_demo_residual.png +0 -0
- setiastro/images/jwstpupil.png +0 -0
- setiastro/images/last_quarter.png +0 -0
- setiastro/images/linearfit.png +0 -0
- setiastro/images/livestacking.png +0 -0
- setiastro/images/mask.png +0 -0
- setiastro/images/maskapply.png +0 -0
- setiastro/images/maskcreate.png +0 -0
- setiastro/images/maskremove.png +0 -0
- setiastro/images/morpho.png +0 -0
- setiastro/images/mosaic.png +0 -0
- setiastro/images/multiscale_decomp.png +0 -0
- setiastro/images/nbtorgb.png +0 -0
- setiastro/images/neutral.png +0 -0
- setiastro/images/new_moon.png +0 -0
- setiastro/images/nuke.png +0 -0
- setiastro/images/openfile.png +0 -0
- setiastro/images/pedestal.png +0 -0
- setiastro/images/pen.png +0 -0
- setiastro/images/pixelmath.png +0 -0
- setiastro/images/platesolve.png +0 -0
- setiastro/images/ppp.png +0 -0
- setiastro/images/pro.png +0 -0
- setiastro/images/project.png +0 -0
- setiastro/images/psf.png +0 -0
- setiastro/images/redo.png +0 -0
- setiastro/images/redoicon.png +0 -0
- setiastro/images/rescale.png +0 -0
- setiastro/images/rgbalign.png +0 -0
- setiastro/images/rgbcombo.png +0 -0
- setiastro/images/rgbextract.png +0 -0
- setiastro/images/rotate180.png +0 -0
- setiastro/images/rotatearbitrary.png +0 -0
- setiastro/images/rotateclockwise.png +0 -0
- setiastro/images/rotatecounterclockwise.png +0 -0
- setiastro/images/satellite.png +0 -0
- setiastro/images/script.png +0 -0
- setiastro/images/selectivecolor.png +0 -0
- setiastro/images/simbad.png +0 -0
- setiastro/images/slot0.png +0 -0
- setiastro/images/slot1.png +0 -0
- setiastro/images/slot2.png +0 -0
- setiastro/images/slot3.png +0 -0
- setiastro/images/slot4.png +0 -0
- setiastro/images/slot5.png +0 -0
- setiastro/images/slot6.png +0 -0
- setiastro/images/slot7.png +0 -0
- setiastro/images/slot8.png +0 -0
- setiastro/images/slot9.png +0 -0
- setiastro/images/spcc.png +0 -0
- setiastro/images/spin_precession_vs_lunar_distance.png +0 -0
- setiastro/images/spinner.gif +0 -0
- setiastro/images/stacking.png +0 -0
- setiastro/images/staradd.png +0 -0
- setiastro/images/staralign.png +0 -0
- setiastro/images/starnet.png +0 -0
- setiastro/images/starregistration.png +0 -0
- setiastro/images/starspike.png +0 -0
- setiastro/images/starstretch.png +0 -0
- setiastro/images/statstretch.png +0 -0
- setiastro/images/supernova.png +0 -0
- setiastro/images/uhs.png +0 -0
- setiastro/images/undoicon.png +0 -0
- setiastro/images/upscale.png +0 -0
- setiastro/images/viewbundle.png +0 -0
- setiastro/images/waning_crescent_1.png +0 -0
- setiastro/images/waning_crescent_2.png +0 -0
- setiastro/images/waning_crescent_3.png +0 -0
- setiastro/images/waning_crescent_4.png +0 -0
- setiastro/images/waning_crescent_5.png +0 -0
- setiastro/images/waning_gibbous_1.png +0 -0
- setiastro/images/waning_gibbous_2.png +0 -0
- setiastro/images/waning_gibbous_3.png +0 -0
- setiastro/images/waning_gibbous_4.png +0 -0
- setiastro/images/waning_gibbous_5.png +0 -0
- setiastro/images/waxing_crescent_1.png +0 -0
- setiastro/images/waxing_crescent_2.png +0 -0
- setiastro/images/waxing_crescent_3.png +0 -0
- setiastro/images/waxing_crescent_4.png +0 -0
- setiastro/images/waxing_crescent_5.png +0 -0
- setiastro/images/waxing_gibbous_1.png +0 -0
- setiastro/images/waxing_gibbous_2.png +0 -0
- setiastro/images/waxing_gibbous_3.png +0 -0
- setiastro/images/waxing_gibbous_4.png +0 -0
- setiastro/images/waxing_gibbous_5.png +0 -0
- setiastro/images/whitebalance.png +0 -0
- setiastro/images/wimi_icon_256x256.png +0 -0
- setiastro/images/wimilogo.png +0 -0
- setiastro/images/wims.png +0 -0
- setiastro/images/wrench_icon.png +0 -0
- setiastro/images/xisfliberator.png +0 -0
- setiastro/qml/ResourceMonitor.qml +128 -0
- setiastro/saspro/__init__.py +20 -0
- setiastro/saspro/__main__.py +964 -0
- setiastro/saspro/_generated/__init__.py +7 -0
- setiastro/saspro/_generated/build_info.py +3 -0
- setiastro/saspro/abe.py +1379 -0
- setiastro/saspro/abe_preset.py +196 -0
- setiastro/saspro/aberration_ai.py +910 -0
- setiastro/saspro/aberration_ai_preset.py +224 -0
- setiastro/saspro/accel_installer.py +218 -0
- setiastro/saspro/accel_workers.py +30 -0
- setiastro/saspro/acv_exporter.py +379 -0
- setiastro/saspro/add_stars.py +627 -0
- setiastro/saspro/astrobin_exporter.py +1010 -0
- setiastro/saspro/astrospike.py +153 -0
- setiastro/saspro/astrospike_python.py +1841 -0
- setiastro/saspro/autostretch.py +198 -0
- setiastro/saspro/backgroundneutral.py +639 -0
- setiastro/saspro/batch_convert.py +328 -0
- setiastro/saspro/batch_renamer.py +522 -0
- setiastro/saspro/blemish_blaster.py +494 -0
- setiastro/saspro/blink_comparator_pro.py +3149 -0
- setiastro/saspro/bundles.py +61 -0
- setiastro/saspro/bundles_dock.py +114 -0
- setiastro/saspro/cheat_sheet.py +213 -0
- setiastro/saspro/clahe.py +371 -0
- setiastro/saspro/comet_stacking.py +1442 -0
- setiastro/saspro/common_tr.py +107 -0
- setiastro/saspro/config.py +38 -0
- setiastro/saspro/config_bootstrap.py +40 -0
- setiastro/saspro/config_manager.py +316 -0
- setiastro/saspro/continuum_subtract.py +1620 -0
- setiastro/saspro/convo.py +1403 -0
- setiastro/saspro/convo_preset.py +414 -0
- setiastro/saspro/copyastro.py +190 -0
- setiastro/saspro/cosmicclarity.py +1593 -0
- setiastro/saspro/cosmicclarity_preset.py +407 -0
- setiastro/saspro/crop_dialog_pro.py +1005 -0
- setiastro/saspro/crop_preset.py +189 -0
- setiastro/saspro/curve_editor_pro.py +2608 -0
- setiastro/saspro/curves_preset.py +375 -0
- setiastro/saspro/debayer.py +673 -0
- setiastro/saspro/debug_utils.py +29 -0
- setiastro/saspro/dnd_mime.py +35 -0
- setiastro/saspro/doc_manager.py +2727 -0
- setiastro/saspro/exoplanet_detector.py +2258 -0
- setiastro/saspro/file_utils.py +284 -0
- setiastro/saspro/fitsmodifier.py +748 -0
- setiastro/saspro/fix_bom.py +32 -0
- setiastro/saspro/free_torch_memory.py +48 -0
- setiastro/saspro/frequency_separation.py +1352 -0
- setiastro/saspro/function_bundle.py +1596 -0
- setiastro/saspro/generate_translations.py +3092 -0
- setiastro/saspro/ghs_dialog_pro.py +728 -0
- setiastro/saspro/ghs_preset.py +284 -0
- setiastro/saspro/graxpert.py +638 -0
- setiastro/saspro/graxpert_preset.py +287 -0
- setiastro/saspro/gui/__init__.py +0 -0
- setiastro/saspro/gui/main_window.py +8928 -0
- setiastro/saspro/gui/mixins/__init__.py +33 -0
- setiastro/saspro/gui/mixins/dock_mixin.py +375 -0
- setiastro/saspro/gui/mixins/file_mixin.py +450 -0
- setiastro/saspro/gui/mixins/geometry_mixin.py +503 -0
- setiastro/saspro/gui/mixins/header_mixin.py +441 -0
- setiastro/saspro/gui/mixins/mask_mixin.py +421 -0
- setiastro/saspro/gui/mixins/menu_mixin.py +391 -0
- setiastro/saspro/gui/mixins/theme_mixin.py +367 -0
- setiastro/saspro/gui/mixins/toolbar_mixin.py +1824 -0
- setiastro/saspro/gui/mixins/update_mixin.py +323 -0
- setiastro/saspro/gui/mixins/view_mixin.py +477 -0
- setiastro/saspro/gui/statistics_dialog.py +47 -0
- setiastro/saspro/halobgon.py +492 -0
- setiastro/saspro/header_viewer.py +448 -0
- setiastro/saspro/headless_utils.py +88 -0
- setiastro/saspro/histogram.py +760 -0
- setiastro/saspro/history_explorer.py +941 -0
- setiastro/saspro/i18n.py +168 -0
- setiastro/saspro/image_combine.py +421 -0
- setiastro/saspro/image_peeker_pro.py +1608 -0
- setiastro/saspro/imageops/__init__.py +37 -0
- setiastro/saspro/imageops/mdi_snap.py +292 -0
- setiastro/saspro/imageops/scnr.py +36 -0
- setiastro/saspro/imageops/starbasedwhitebalance.py +210 -0
- setiastro/saspro/imageops/stretch.py +236 -0
- setiastro/saspro/isophote.py +1186 -0
- setiastro/saspro/layers.py +208 -0
- setiastro/saspro/layers_dock.py +714 -0
- setiastro/saspro/lazy_imports.py +193 -0
- setiastro/saspro/legacy/__init__.py +2 -0
- setiastro/saspro/legacy/image_manager.py +2360 -0
- setiastro/saspro/legacy/numba_utils.py +3676 -0
- setiastro/saspro/legacy/xisf.py +1213 -0
- setiastro/saspro/linear_fit.py +537 -0
- setiastro/saspro/live_stacking.py +1854 -0
- setiastro/saspro/log_bus.py +5 -0
- setiastro/saspro/logging_config.py +460 -0
- setiastro/saspro/luminancerecombine.py +510 -0
- setiastro/saspro/main_helpers.py +201 -0
- setiastro/saspro/mask_creation.py +1090 -0
- setiastro/saspro/masks_core.py +56 -0
- setiastro/saspro/mdi_widgets.py +353 -0
- setiastro/saspro/memory_utils.py +666 -0
- setiastro/saspro/metadata_patcher.py +75 -0
- setiastro/saspro/mfdeconv.py +3909 -0
- setiastro/saspro/mfdeconv_earlystop.py +71 -0
- setiastro/saspro/mfdeconvcudnn.py +3312 -0
- setiastro/saspro/mfdeconvsport.py +2459 -0
- setiastro/saspro/minorbodycatalog.py +567 -0
- setiastro/saspro/morphology.py +411 -0
- setiastro/saspro/multiscale_decomp.py +1751 -0
- setiastro/saspro/nbtorgb_stars.py +541 -0
- setiastro/saspro/numba_utils.py +3145 -0
- setiastro/saspro/numba_warmup.py +141 -0
- setiastro/saspro/ops/__init__.py +9 -0
- setiastro/saspro/ops/command_help_dialog.py +623 -0
- setiastro/saspro/ops/command_runner.py +217 -0
- setiastro/saspro/ops/commands.py +1594 -0
- setiastro/saspro/ops/script_editor.py +1105 -0
- setiastro/saspro/ops/scripts.py +1476 -0
- setiastro/saspro/ops/settings.py +637 -0
- setiastro/saspro/parallel_utils.py +554 -0
- setiastro/saspro/pedestal.py +121 -0
- setiastro/saspro/perfect_palette_picker.py +1105 -0
- setiastro/saspro/pipeline.py +110 -0
- setiastro/saspro/pixelmath.py +1604 -0
- setiastro/saspro/plate_solver.py +2480 -0
- setiastro/saspro/project_io.py +797 -0
- setiastro/saspro/psf_utils.py +136 -0
- setiastro/saspro/psf_viewer.py +631 -0
- setiastro/saspro/pyi_rthook_astroquery.py +95 -0
- setiastro/saspro/remove_green.py +331 -0
- setiastro/saspro/remove_stars.py +1599 -0
- setiastro/saspro/remove_stars_preset.py +446 -0
- setiastro/saspro/resources.py +570 -0
- setiastro/saspro/rgb_combination.py +208 -0
- setiastro/saspro/rgb_extract.py +19 -0
- setiastro/saspro/rgbalign.py +727 -0
- setiastro/saspro/runtime_imports.py +7 -0
- setiastro/saspro/runtime_torch.py +754 -0
- setiastro/saspro/save_options.py +73 -0
- setiastro/saspro/selective_color.py +1614 -0
- setiastro/saspro/sfcc.py +1530 -0
- setiastro/saspro/shortcuts.py +3125 -0
- setiastro/saspro/signature_insert.py +1106 -0
- setiastro/saspro/stacking_suite.py +19069 -0
- setiastro/saspro/star_alignment.py +7383 -0
- setiastro/saspro/star_alignment_preset.py +329 -0
- setiastro/saspro/star_metrics.py +49 -0
- setiastro/saspro/star_spikes.py +769 -0
- setiastro/saspro/star_stretch.py +542 -0
- setiastro/saspro/stat_stretch.py +554 -0
- setiastro/saspro/status_log_dock.py +78 -0
- setiastro/saspro/subwindow.py +3523 -0
- setiastro/saspro/supernovaasteroidhunter.py +1719 -0
- setiastro/saspro/swap_manager.py +134 -0
- setiastro/saspro/torch_backend.py +89 -0
- setiastro/saspro/torch_rejection.py +434 -0
- setiastro/saspro/translations/all_source_strings.json +4726 -0
- setiastro/saspro/translations/ar_translations.py +4096 -0
- setiastro/saspro/translations/de_translations.py +3728 -0
- setiastro/saspro/translations/es_translations.py +4169 -0
- setiastro/saspro/translations/fr_translations.py +4090 -0
- setiastro/saspro/translations/hi_translations.py +3803 -0
- setiastro/saspro/translations/integrate_translations.py +271 -0
- setiastro/saspro/translations/it_translations.py +4728 -0
- setiastro/saspro/translations/ja_translations.py +3834 -0
- setiastro/saspro/translations/pt_translations.py +3847 -0
- setiastro/saspro/translations/ru_translations.py +3082 -0
- setiastro/saspro/translations/saspro_ar.qm +0 -0
- setiastro/saspro/translations/saspro_ar.ts +16019 -0
- setiastro/saspro/translations/saspro_de.qm +0 -0
- setiastro/saspro/translations/saspro_de.ts +14548 -0
- setiastro/saspro/translations/saspro_es.qm +0 -0
- setiastro/saspro/translations/saspro_es.ts +16202 -0
- setiastro/saspro/translations/saspro_fr.qm +0 -0
- setiastro/saspro/translations/saspro_fr.ts +15870 -0
- setiastro/saspro/translations/saspro_hi.qm +0 -0
- setiastro/saspro/translations/saspro_hi.ts +14855 -0
- setiastro/saspro/translations/saspro_it.qm +0 -0
- setiastro/saspro/translations/saspro_it.ts +19046 -0
- setiastro/saspro/translations/saspro_ja.qm +0 -0
- setiastro/saspro/translations/saspro_ja.ts +14980 -0
- setiastro/saspro/translations/saspro_pt.qm +0 -0
- setiastro/saspro/translations/saspro_pt.ts +15024 -0
- setiastro/saspro/translations/saspro_ru.qm +0 -0
- setiastro/saspro/translations/saspro_ru.ts +11835 -0
- setiastro/saspro/translations/saspro_sw.qm +0 -0
- setiastro/saspro/translations/saspro_sw.ts +15237 -0
- setiastro/saspro/translations/saspro_uk.qm +0 -0
- setiastro/saspro/translations/saspro_uk.ts +15248 -0
- setiastro/saspro/translations/saspro_zh.qm +0 -0
- setiastro/saspro/translations/saspro_zh.ts +15289 -0
- setiastro/saspro/translations/sw_translations.py +3897 -0
- setiastro/saspro/translations/uk_translations.py +3929 -0
- setiastro/saspro/translations/zh_translations.py +3910 -0
- setiastro/saspro/versioning.py +77 -0
- setiastro/saspro/view_bundle.py +1558 -0
- setiastro/saspro/wavescale_hdr.py +648 -0
- setiastro/saspro/wavescale_hdr_preset.py +101 -0
- setiastro/saspro/wavescalede.py +683 -0
- setiastro/saspro/wavescalede_preset.py +230 -0
- setiastro/saspro/wcs_update.py +374 -0
- setiastro/saspro/whitebalance.py +540 -0
- setiastro/saspro/widgets/__init__.py +48 -0
- setiastro/saspro/widgets/common_utilities.py +306 -0
- setiastro/saspro/widgets/graphics_views.py +122 -0
- setiastro/saspro/widgets/image_utils.py +518 -0
- setiastro/saspro/widgets/minigame/game.js +991 -0
- setiastro/saspro/widgets/minigame/index.html +53 -0
- setiastro/saspro/widgets/minigame/style.css +241 -0
- setiastro/saspro/widgets/preview_dialogs.py +280 -0
- setiastro/saspro/widgets/resource_monitor.py +313 -0
- setiastro/saspro/widgets/spinboxes.py +290 -0
- setiastro/saspro/widgets/themed_buttons.py +13 -0
- setiastro/saspro/widgets/wavelet_utils.py +331 -0
- setiastro/saspro/wimi.py +7367 -0
- setiastro/saspro/wims.py +588 -0
- setiastro/saspro/window_shelf.py +185 -0
- setiastro/saspro/xisf.py +1213 -0
- setiastrosuitepro-1.6.7.dist-info/METADATA +279 -0
- setiastrosuitepro-1.6.7.dist-info/RECORD +394 -0
- setiastrosuitepro-1.6.7.dist-info/WHEEL +4 -0
- setiastrosuitepro-1.6.7.dist-info/entry_points.txt +6 -0
- setiastrosuitepro-1.6.7.dist-info/licenses/LICENSE +674 -0
- setiastrosuitepro-1.6.7.dist-info/licenses/license.txt +2580 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# src/setiastro/saspro/acv_exporter.py
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from PyQt6.QtCore import Qt, QCoreApplication
|
|
9
|
+
from PyQt6.QtWidgets import (
|
|
10
|
+
QDialog, QVBoxLayout, QHBoxLayout, QGridLayout, QGroupBox,
|
|
11
|
+
QLabel, QLineEdit, QPushButton, QFileDialog, QComboBox,
|
|
12
|
+
QMessageBox, QWidget
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
# If you have a canonical place for "global save_as", wire it here.
|
|
16
|
+
# Example placeholders (change to your actual import):
|
|
17
|
+
# from setiastro.saspro.actions.save_as import save_as
|
|
18
|
+
# from setiastro.saspro.fileio.save_as import save_as
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _tr(s: str) -> str:
|
|
22
|
+
return QCoreApplication.translate("AstroCatalogueViewerExporter", s)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AstroCatalogueViewerExporterDialog(QDialog):
|
|
26
|
+
"""
|
|
27
|
+
Astro Catalogue Viewer Exporter
|
|
28
|
+
- Persist folders in QSettings
|
|
29
|
+
- Export current active document/view via your global save_as
|
|
30
|
+
- Route by name prefix: M -> Messier, NGC -> NGC, IC -> IC, C -> Caldwell, else Master
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
# QSettings keys
|
|
34
|
+
K_MASTER = "acv_export/master_folder"
|
|
35
|
+
K_M = "acv_export/messier_folder"
|
|
36
|
+
K_NGC = "acv_export/ngc_folder"
|
|
37
|
+
K_IC = "acv_export/ic_folder"
|
|
38
|
+
K_C = "acv_export/caldwell_folder"
|
|
39
|
+
K_FMT = "acv_export/format"
|
|
40
|
+
|
|
41
|
+
def __init__(self, parent, dm, doc):
|
|
42
|
+
super().__init__(parent)
|
|
43
|
+
self.dm = dm
|
|
44
|
+
self.doc = doc
|
|
45
|
+
self.setObjectName("acv_exporter_dialog")
|
|
46
|
+
self.setWindowTitle(_tr("Astro Catalogue Viewer Exporter"))
|
|
47
|
+
|
|
48
|
+
# Prefer not using WA_DeleteOnClose if that’s a Linux landmine for you.
|
|
49
|
+
# (You can still set it from caller if you want.)
|
|
50
|
+
self._main = parent
|
|
51
|
+
self._settings = getattr(parent, "settings", None) # typical SASpro pattern
|
|
52
|
+
|
|
53
|
+
root = QVBoxLayout(self)
|
|
54
|
+
root.setContentsMargins(12, 12, 12, 12)
|
|
55
|
+
root.setSpacing(10)
|
|
56
|
+
|
|
57
|
+
# -------------------------
|
|
58
|
+
# Folder section
|
|
59
|
+
# -------------------------
|
|
60
|
+
gb = QGroupBox(_tr("Image folders"), self)
|
|
61
|
+
g = QGridLayout(gb)
|
|
62
|
+
g.setContentsMargins(10, 10, 10, 10)
|
|
63
|
+
g.setHorizontalSpacing(10)
|
|
64
|
+
g.setVerticalSpacing(8)
|
|
65
|
+
|
|
66
|
+
self.ed_master = QLineEdit(self)
|
|
67
|
+
self.btn_master = QPushButton(_tr("Browse…"), self)
|
|
68
|
+
self.btn_master.clicked.connect(lambda: self._browse_folder(self.ed_master))
|
|
69
|
+
|
|
70
|
+
g.addWidget(QLabel(_tr("Master Image Folder")), 0, 0)
|
|
71
|
+
g.addWidget(self.ed_master, 0, 1)
|
|
72
|
+
g.addWidget(self.btn_master, 0, 2)
|
|
73
|
+
|
|
74
|
+
gb2 = QGroupBox(_tr("Image folder per catalog"), self)
|
|
75
|
+
gg = QGridLayout(gb2)
|
|
76
|
+
gg.setContentsMargins(10, 10, 10, 10)
|
|
77
|
+
gg.setHorizontalSpacing(10)
|
|
78
|
+
gg.setVerticalSpacing(8)
|
|
79
|
+
|
|
80
|
+
self.ed_m = QLineEdit(self)
|
|
81
|
+
self.ed_ngc = QLineEdit(self)
|
|
82
|
+
self.ed_ic = QLineEdit(self)
|
|
83
|
+
self.ed_c = QLineEdit(self)
|
|
84
|
+
|
|
85
|
+
bm = QPushButton(_tr("Browse…"), self); bm.clicked.connect(lambda: self._browse_folder(self.ed_m))
|
|
86
|
+
bn = QPushButton(_tr("Browse…"), self); bn.clicked.connect(lambda: self._browse_folder(self.ed_ngc))
|
|
87
|
+
bi = QPushButton(_tr("Browse…"), self); bi.clicked.connect(lambda: self._browse_folder(self.ed_ic))
|
|
88
|
+
bc = QPushButton(_tr("Browse…"), self); bc.clicked.connect(lambda: self._browse_folder(self.ed_c))
|
|
89
|
+
|
|
90
|
+
gg.addWidget(QLabel(_tr("Messier")), 0, 0); gg.addWidget(self.ed_m, 0, 1); gg.addWidget(bm, 0, 2)
|
|
91
|
+
gg.addWidget(QLabel(_tr("NGC")), 1, 0); gg.addWidget(self.ed_ngc, 1, 1); gg.addWidget(bn, 1, 2)
|
|
92
|
+
gg.addWidget(QLabel(_tr("IC")), 2, 0); gg.addWidget(self.ed_ic, 2, 1); gg.addWidget(bi, 2, 2)
|
|
93
|
+
gg.addWidget(QLabel(_tr("Caldwell")),3, 0); gg.addWidget(self.ed_c, 3, 1); gg.addWidget(bc, 3, 2)
|
|
94
|
+
|
|
95
|
+
root.addWidget(gb)
|
|
96
|
+
root.addWidget(gb2)
|
|
97
|
+
|
|
98
|
+
# -------------------------
|
|
99
|
+
# Export controls
|
|
100
|
+
# -------------------------
|
|
101
|
+
row = QHBoxLayout()
|
|
102
|
+
row.setSpacing(10)
|
|
103
|
+
|
|
104
|
+
self.ed_name = QLineEdit(self)
|
|
105
|
+
self.ed_name.setPlaceholderText(_tr("e.g. M31, NGC5060, M31_HaOnly…"))
|
|
106
|
+
|
|
107
|
+
self.cmb_fmt = QComboBox(self)
|
|
108
|
+
# keep these lower-case as “extensions”
|
|
109
|
+
self.cmb_fmt.addItems(["jpg", "png", "tif"])
|
|
110
|
+
|
|
111
|
+
self.btn_export = QPushButton(_tr("Export"), self)
|
|
112
|
+
self.btn_export.clicked.connect(self._on_export)
|
|
113
|
+
|
|
114
|
+
row.addWidget(QLabel(_tr("Image Name")), 0)
|
|
115
|
+
row.addWidget(self.ed_name, 2)
|
|
116
|
+
row.addWidget(QLabel(_tr("Type")), 0)
|
|
117
|
+
row.addWidget(self.cmb_fmt, 0)
|
|
118
|
+
row.addWidget(self.btn_export, 0)
|
|
119
|
+
|
|
120
|
+
root.addLayout(row)
|
|
121
|
+
|
|
122
|
+
# Load persisted settings
|
|
123
|
+
self._load_settings()
|
|
124
|
+
|
|
125
|
+
# Save on edits (lightweight)
|
|
126
|
+
self.ed_master.textChanged.connect(self._save_settings)
|
|
127
|
+
self.ed_m.textChanged.connect(self._save_settings)
|
|
128
|
+
self.ed_ngc.textChanged.connect(self._save_settings)
|
|
129
|
+
self.ed_ic.textChanged.connect(self._save_settings)
|
|
130
|
+
self.ed_c.textChanged.connect(self._save_settings)
|
|
131
|
+
self.cmb_fmt.currentTextChanged.connect(self._save_settings)
|
|
132
|
+
|
|
133
|
+
# -------------------------
|
|
134
|
+
# Settings
|
|
135
|
+
# -------------------------
|
|
136
|
+
def _load_settings(self):
|
|
137
|
+
s = self._settings
|
|
138
|
+
if s is None:
|
|
139
|
+
return
|
|
140
|
+
self.ed_master.setText(s.value(self.K_MASTER, "", type=str) or "")
|
|
141
|
+
self.ed_m.setText(s.value(self.K_M, "", type=str) or "")
|
|
142
|
+
self.ed_ngc.setText(s.value(self.K_NGC, "", type=str) or "")
|
|
143
|
+
self.ed_ic.setText(s.value(self.K_IC, "", type=str) or "")
|
|
144
|
+
self.ed_c.setText(s.value(self.K_C, "", type=str) or "")
|
|
145
|
+
fmt = (s.value(self.K_FMT, "png", type=str) or "png").lower()
|
|
146
|
+
idx = self.cmb_fmt.findText(fmt)
|
|
147
|
+
if idx >= 0:
|
|
148
|
+
self.cmb_fmt.setCurrentIndex(idx)
|
|
149
|
+
|
|
150
|
+
def _save_settings(self):
|
|
151
|
+
s = self._settings
|
|
152
|
+
if s is None:
|
|
153
|
+
return
|
|
154
|
+
s.setValue(self.K_MASTER, self.ed_master.text().strip())
|
|
155
|
+
s.setValue(self.K_M, self.ed_m.text().strip())
|
|
156
|
+
s.setValue(self.K_NGC, self.ed_ngc.text().strip())
|
|
157
|
+
s.setValue(self.K_IC, self.ed_ic.text().strip())
|
|
158
|
+
s.setValue(self.K_C, self.ed_c.text().strip())
|
|
159
|
+
s.setValue(self.K_FMT, self.cmb_fmt.currentText().strip().lower())
|
|
160
|
+
try:
|
|
161
|
+
s.sync()
|
|
162
|
+
except Exception:
|
|
163
|
+
pass
|
|
164
|
+
|
|
165
|
+
# -------------------------
|
|
166
|
+
# Folder helpers
|
|
167
|
+
# -------------------------
|
|
168
|
+
def _browse_folder(self, target_edit: QLineEdit):
|
|
169
|
+
start = target_edit.text().strip() or os.path.expanduser("~")
|
|
170
|
+
path = QFileDialog.getExistingDirectory(self, _tr("Select folder"), start)
|
|
171
|
+
if path:
|
|
172
|
+
target_edit.setText(path)
|
|
173
|
+
|
|
174
|
+
# -------------------------
|
|
175
|
+
# Active doc resolution (ROI aware)
|
|
176
|
+
# -------------------------
|
|
177
|
+
def _get_active_doc(self):
|
|
178
|
+
mw = self._main
|
|
179
|
+
mdi = getattr(mw, "mdi", None)
|
|
180
|
+
dm = getattr(mw, "doc_manager", None) or getattr(mw, "docman", None)
|
|
181
|
+
|
|
182
|
+
if mdi is None or not hasattr(mdi, "activeSubWindow"):
|
|
183
|
+
return None
|
|
184
|
+
|
|
185
|
+
sw = mdi.activeSubWindow()
|
|
186
|
+
if not sw:
|
|
187
|
+
return None
|
|
188
|
+
|
|
189
|
+
view = sw.widget()
|
|
190
|
+
|
|
191
|
+
# Prefer ROI-aware doc lookup via DocManager
|
|
192
|
+
if dm is not None and hasattr(dm, "get_document_for_view"):
|
|
193
|
+
try:
|
|
194
|
+
doc = dm.get_document_for_view(view)
|
|
195
|
+
if doc is not None:
|
|
196
|
+
return doc
|
|
197
|
+
except Exception:
|
|
198
|
+
pass
|
|
199
|
+
|
|
200
|
+
# Fallback: view.document
|
|
201
|
+
return getattr(view, "document", None)
|
|
202
|
+
|
|
203
|
+
# -------------------------
|
|
204
|
+
# Routing logic
|
|
205
|
+
# -------------------------
|
|
206
|
+
@staticmethod
|
|
207
|
+
def _pick_target_folder(name: str, master: str, m: str, ngc: str, ic: str, c: str) -> str:
|
|
208
|
+
raw = (name or "").strip().upper()
|
|
209
|
+
|
|
210
|
+
# routing normalization: remove spaces (optionally also "_" and "-" if you want)
|
|
211
|
+
u = re.sub(r"\s+", "", raw)
|
|
212
|
+
|
|
213
|
+
if re.match(r"^M\d+", u):
|
|
214
|
+
return m or master
|
|
215
|
+
if re.match(r"^NGC\d+", u): # optional tighten
|
|
216
|
+
return ngc or master
|
|
217
|
+
if re.match(r"^IC\d+", u): # optional tighten
|
|
218
|
+
return ic or master
|
|
219
|
+
if re.match(r"^C\d+", u):
|
|
220
|
+
return c or master
|
|
221
|
+
return master
|
|
222
|
+
|
|
223
|
+
def _normalize_for_routing(self, name: str) -> str:
|
|
224
|
+
# Uppercase + remove spaces only (routing only)
|
|
225
|
+
u = (name or "").strip().upper()
|
|
226
|
+
u = re.sub(r"\s+", "", u)
|
|
227
|
+
return u
|
|
228
|
+
|
|
229
|
+
def _sanitize_filename(self, s: str) -> str:
|
|
230
|
+
# Keep it simple + safe across OSes
|
|
231
|
+
s = (s or "").strip()
|
|
232
|
+
s = s.replace("\\", "_").replace("/", "_").replace(":", "_")
|
|
233
|
+
s = re.sub(r"\s+", " ", s) # keep single spaces
|
|
234
|
+
s = re.sub(r"[^\w\-\.\(\) ]+", "", s) # drop odd chars
|
|
235
|
+
return s.strip() or "export"
|
|
236
|
+
|
|
237
|
+
# -------------------------
|
|
238
|
+
# Export action
|
|
239
|
+
# -------------------------
|
|
240
|
+
def _on_export(self):
|
|
241
|
+
fmt = self.cmb_fmt.currentText().strip().lower()
|
|
242
|
+
|
|
243
|
+
# -------------------------
|
|
244
|
+
# Name (raw + routing-normalized)
|
|
245
|
+
# -------------------------
|
|
246
|
+
raw_name = self.ed_name.text().strip()
|
|
247
|
+
if not raw_name:
|
|
248
|
+
QMessageBox.information(
|
|
249
|
+
self, _tr("Export"),
|
|
250
|
+
_tr("Please enter an Image Name (e.g. M31, NGC5060…).")
|
|
251
|
+
)
|
|
252
|
+
return
|
|
253
|
+
|
|
254
|
+
route_name = self._normalize_for_routing(raw_name)
|
|
255
|
+
|
|
256
|
+
# -------------------------
|
|
257
|
+
# Active doc (passed in)
|
|
258
|
+
# -------------------------
|
|
259
|
+
doc = self.doc
|
|
260
|
+
if doc is None or getattr(doc, "image", None) is None:
|
|
261
|
+
QMessageBox.information(self, _tr("Export"), _tr("No active image. Open an image first."))
|
|
262
|
+
return
|
|
263
|
+
|
|
264
|
+
# -------------------------
|
|
265
|
+
# Folder config
|
|
266
|
+
# -------------------------
|
|
267
|
+
master_dir = self.ed_master.text().strip()
|
|
268
|
+
if not master_dir:
|
|
269
|
+
QMessageBox.information(self, _tr("Export"), _tr("Please set a Master Image Folder."))
|
|
270
|
+
return
|
|
271
|
+
|
|
272
|
+
messier_dir = self.ed_m.text().strip() or master_dir
|
|
273
|
+
ngc_dir = self.ed_ngc.text().strip() or master_dir
|
|
274
|
+
ic_dir = self.ed_ic.text().strip() or master_dir
|
|
275
|
+
caldwell_dir = self.ed_c.text().strip() or master_dir
|
|
276
|
+
|
|
277
|
+
# -------------------------
|
|
278
|
+
# Route by prefix (digit-guard)
|
|
279
|
+
# -------------------------
|
|
280
|
+
if route_name.startswith("M") and route_name[1:2].isdigit():
|
|
281
|
+
base_dir = messier_dir
|
|
282
|
+
elif route_name.startswith("NGC") and route_name[3:4].isdigit():
|
|
283
|
+
base_dir = ngc_dir
|
|
284
|
+
elif route_name.startswith("IC") and route_name[2:3].isdigit():
|
|
285
|
+
base_dir = ic_dir
|
|
286
|
+
elif route_name.startswith("C") and route_name[1:2].isdigit():
|
|
287
|
+
base_dir = caldwell_dir
|
|
288
|
+
else:
|
|
289
|
+
base_dir = master_dir
|
|
290
|
+
|
|
291
|
+
# Ensure folder exists
|
|
292
|
+
try:
|
|
293
|
+
Path(base_dir).mkdir(parents=True, exist_ok=True)
|
|
294
|
+
except Exception as e:
|
|
295
|
+
QMessageBox.critical(
|
|
296
|
+
self, _tr("Export"),
|
|
297
|
+
_tr("Could not create folder:\n{0}\n\n{1}").format(base_dir, str(e))
|
|
298
|
+
)
|
|
299
|
+
return
|
|
300
|
+
|
|
301
|
+
# Filename uses user's raw name (sanitized for filesystem)
|
|
302
|
+
file_stem = self._sanitize_filename(raw_name)
|
|
303
|
+
out_path = str(Path(base_dir) / f"{file_stem}.{fmt}")
|
|
304
|
+
|
|
305
|
+
# -------------------------
|
|
306
|
+
# Save
|
|
307
|
+
# -------------------------
|
|
308
|
+
ok, err = self._save_current_doc_to_path(doc, out_path, fmt)
|
|
309
|
+
if ok:
|
|
310
|
+
QMessageBox.information(self, _tr("Export"), _tr("Exported:\n{0}").format(out_path))
|
|
311
|
+
else:
|
|
312
|
+
QMessageBox.critical(self, _tr("Export"), _tr("Export failed:\n{0}").format(err or "Unknown error"))
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def _save_current_doc_to_path(self, doc, out_path: str, fmt: str) -> tuple[bool, str]:
|
|
316
|
+
try:
|
|
317
|
+
import numpy as np
|
|
318
|
+
from astropy.io import fits
|
|
319
|
+
from astropy.wcs import WCS
|
|
320
|
+
|
|
321
|
+
from setiastro.saspro.legacy.image_manager import save_image as legacy_save_image
|
|
322
|
+
|
|
323
|
+
img = getattr(doc, "image", None)
|
|
324
|
+
if img is None:
|
|
325
|
+
return False, "Active document has no image data."
|
|
326
|
+
|
|
327
|
+
# Ensure numpy array
|
|
328
|
+
img_array = np.asarray(img)
|
|
329
|
+
|
|
330
|
+
# Mono detection (your saver uses this for RAW/XISF paths; safe to provide anyway)
|
|
331
|
+
is_mono = (img_array.ndim == 2) or (img_array.ndim == 3 and img_array.shape[2] == 1)
|
|
332
|
+
|
|
333
|
+
# Preserve bit depth for tif/fit if the doc has it; PNG/JPG ignore bit depth anyway.
|
|
334
|
+
bit_depth = (
|
|
335
|
+
getattr(doc, "bit_depth", None)
|
|
336
|
+
or getattr(doc, "bitdepth", None)
|
|
337
|
+
or (getattr(doc, "metadata", None) or {}).get("bit_depth")
|
|
338
|
+
or (getattr(doc, "metadata", None) or {}).get("bitDepth")
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
# Pull headers/WCS from metadata (matches your SASv2->SASpro WCS preference)
|
|
342
|
+
md = getattr(doc, "metadata", None) or {}
|
|
343
|
+
|
|
344
|
+
original_header = md.get("original_header", None)
|
|
345
|
+
wcs_header = None
|
|
346
|
+
|
|
347
|
+
# If wcs is stored as astropy.wcs.WCS, convert to Header
|
|
348
|
+
wcs_obj = md.get("wcs", None)
|
|
349
|
+
if wcs_obj is not None:
|
|
350
|
+
try:
|
|
351
|
+
if isinstance(wcs_obj, WCS):
|
|
352
|
+
wcs_header = wcs_obj.to_header(relax=True)
|
|
353
|
+
elif isinstance(wcs_obj, fits.Header):
|
|
354
|
+
wcs_header = wcs_obj
|
|
355
|
+
except Exception:
|
|
356
|
+
wcs_header = None
|
|
357
|
+
|
|
358
|
+
# Optional passthroughs (safe if missing)
|
|
359
|
+
image_meta = md.get("image_meta", None) or md.get("image_metadata", None)
|
|
360
|
+
file_meta = md.get("file_meta", None) or md.get("xisf_metadata", None)
|
|
361
|
+
|
|
362
|
+
# IMPORTANT:
|
|
363
|
+
# legacy_save_image expects original_format to be the desired output format,
|
|
364
|
+
# and will normalize extension itself.
|
|
365
|
+
legacy_save_image(
|
|
366
|
+
img_array=img_array,
|
|
367
|
+
filename=out_path,
|
|
368
|
+
original_format=fmt, # "jpg","png","tif","fit"
|
|
369
|
+
bit_depth=bit_depth, # keep same depth for tif/fit when possible
|
|
370
|
+
original_header=original_header,
|
|
371
|
+
is_mono=is_mono,
|
|
372
|
+
image_meta=image_meta,
|
|
373
|
+
file_meta=file_meta,
|
|
374
|
+
wcs_header=wcs_header, # merged into FITS header (your saver supports this)
|
|
375
|
+
)
|
|
376
|
+
return True, ""
|
|
377
|
+
|
|
378
|
+
except Exception as e:
|
|
379
|
+
return False, f"{type(e).__name__}: {e}"
|