From 53472d807c9a4b5567358832cc2b52ea098427ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Sun, 27 Apr 2025 22:54:29 +0200 Subject: [PATCH] Adding new scripts --- scripts/convert to XISF | 6 ----- scripts/measure HFR | 49 ++++++++++++++++++++++++++++++++++++++ scripts/modify FITS header | 2 ++ scripts/plate solve | 17 +++++++++++++ scripts/scripts.qrc | 2 ++ 5 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 scripts/measure HFR create mode 100644 scripts/plate solve diff --git a/scripts/convert to XISF b/scripts/convert to XISF index 70b3cc6..26400df 100644 --- a/scripts/convert to XISF +++ b/scripts/convert to XISF @@ -1,11 +1,5 @@ core.log("This script convert any FITS file into XISF with ZSTD compression"); -if(files.length == 0) -{ - core.log("No input files"); - throw ""; -} - let compression = {"compressionType": "zstd+sh"}; for(file of files) diff --git a/scripts/measure HFR b/scripts/measure HFR new file mode 100644 index 0000000..b7841c1 --- /dev/null +++ b/scripts/measure HFR @@ -0,0 +1,49 @@ +core.log("Measure HFR and eccentricity of stars"); + +var chart = { + "title": "Measure stars", + "legend": {"visible": true, "align": "left"}, + "series": [ + { + "title": "HFR", + "type": "bar", + "y":[] + }, + { + "title": "Ecc", + "type": "bar", + "y":[] + }, + { + "title": "Star count", + "type": "linePoints", + "y":[], + "y2": true, + "bestFit": true + } + ] +}; + +core.setSolverProfile(5); +for(file of files) +{ + if(file.suffix() == "fits" || file.suffix() == "fit" || file.suffix() == "xisf") + { + var stars = file.extractStars(true); + var sumHFR = 0; + var ecc = 0; + for(star of stars) + { + sumHFR += star.HFR; + ecc += Math.sqrt(1 - (star.b * star.b) / (star.a * star.a)); + } + chart.series[0].y.push(sumHFR / stars.length); + chart.series[1].y.push(ecc / stars.length); + chart.series[2].y.push(stars.length); + + core.log(file.fileName() + " Stars:" + stars.length + " HFR: " + sumHFR / stars.length + " Ecc: " + ecc / stars.length); + } +} + +core.plot(chart); + diff --git a/scripts/modify FITS header b/scripts/modify FITS header index 6edc4ee..9b41f43 100644 --- a/scripts/modify FITS header +++ b/scripts/modify FITS header @@ -1,3 +1,5 @@ +core.log("Script to modify FITS header in FITS and XISF files"); + function checkFITS(key) { const noEditableKey = ["SIMPLE", "BITPIX", "NAXIS", "NAXIS1", "NAXIS2", "NAXIS3", "EXTEND", "BZERO", "BSCALE"]; diff --git a/scripts/plate solve b/scripts/plate solve new file mode 100644 index 0000000..b947d58 --- /dev/null +++ b/scripts/plate solve @@ -0,0 +1,17 @@ +core.log("Plate solve and update solution"); + +var first = true; + +for(file of files) +{ + if(file.suffix() == "fits" || file.suffix() == "fit" || file.suffix() == "xisf") + { + var solution = file.solve(true); + if(first) + { + core.setStartingSolution(solution); + first = false; + } + core.log(file.fileName() + " " + "RA: " + (solution.ra / 15) + "h DEC: " + solution.dec + "deg"); + } +} diff --git a/scripts/scripts.qrc b/scripts/scripts.qrc index fabfd07..456baef 100644 --- a/scripts/scripts.qrc +++ b/scripts/scripts.qrc @@ -4,5 +4,7 @@ convert to XISF median modify FITS header + measure HFR + plate solve