From 40441eb397a58b3a0781ad80250d7c3ecb32fc42 Mon Sep 17 00:00:00 2001 From: Florian Merges Date: Thu, 19 Apr 2018 12:31:22 +0100 Subject: [PATCH 1/4] Add support for Python 3 --- src/RadProfModule.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/RadProfModule.c b/src/RadProfModule.c index bc68122..46b4f6d 100644 --- a/src/RadProfModule.c +++ b/src/RadProfModule.c @@ -1103,12 +1103,41 @@ static PyMethodDef radProfMethods[] = { {NULL, NULL, 0, NULL} /* Sentinel */ }; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + "radProf", /* m_name */ + radProfModule_doc, /* m_doc */ + -1, /* m_size */ + radProfMethods, /* m_methods */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL, /* m_free */ +}; +#endif + // Module initialization function -PyMODINIT_FUNC initradProf(void) { +PyMODINIT_FUNC +#if PY_MAJOR_VERSION >= 3 +PyInit_radProf(void) +#else +initradProf(void) +#endif +{ PyObject *m; +#if PY_MAJOR_VERSION >= 3 + m = PyModule_Create(&moduledef); +#else m = Py_InitModule3("radProf", radProfMethods, radProfModule_doc); +#endif if (m == NULL) - return; + return m; import_array(); + +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } From 8f17d3815b6922f8c8ae9d717667223fa67b16e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavol=20Gajdo=C5=A1?= Date: Fri, 22 Nov 2024 19:00:10 +0100 Subject: [PATCH 2/4] update for py3 --- python/Centroid.py | 6 +++--- python/FakeData.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/Centroid.py b/python/Centroid.py index d5b46b8..cd04fac 100644 --- a/python/Centroid.py +++ b/python/Centroid.py @@ -579,9 +579,9 @@ def checkSignal( xyCtr = xyCtr, xySize = (outerRad, outerRad), ) - subMask = subMaskObj.getSubFrame().astype(numpy.bool) # force type and copy + subMask = subMaskObj.getSubFrame().astype(numpy.bool_) # force type and copy else: - subMask = numpy.zeros(subData.shape, dtype=numpy.bool) + subMask = numpy.zeros(subData.shape, dtype=numpy.bool_) # create circleMask; a centered circle of radius rad # with 0s in the middle and 1s outside @@ -656,7 +656,7 @@ def conditionMask(mask): """ if mask is None: return None - return conditionArr(mask, numpy.bool) + return conditionArr(mask, numpy.bool_) def conditionArr(arr, desType): """Convert a sequence to a numpy array of the desired type. diff --git a/python/FakeData.py b/python/FakeData.py index 5889ac2..f14a544 100755 --- a/python/FakeData.py +++ b/python/FakeData.py @@ -64,7 +64,7 @@ def addNoise( - sky sky level, in ADU - ccdInfo a PyGuide.CCDInfo object """ - outData = numpy.add(data, sky).astype(numpy.int) + outData = numpy.add(data, sky).astype(numpy.int32) outData = numpy.random.poisson(lam = outData * ccdInfo.ccdGain) / ccdInfo.ccdGain outData += numpy.random.normal(loc = ccdInfo.bias, scale = ccdInfo.readNoise/float(ccdInfo.ccdGain), size = data.shape) # truncate data and return as UInt16 From 25337064f2ce3b204c1e68dfca977bf2ec8355a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavol=20Gajdo=C5=A1?= Date: Fri, 22 Nov 2024 19:00:50 +0100 Subject: [PATCH 3/4] update for py3 --- tests/Stats.py | 2 +- tests/testCentroid.py | 4 +- tests/testCentroidLong.py | 84 +++++++++++++++++++------------------- tests/testStarShape.py | 14 +++---- tests/testStarShapeLong.py | 84 +++++++++++++++++++------------------- tests/timeCentroid.py | 72 ++++++++++++++++---------------- 6 files changed, 130 insertions(+), 130 deletions(-) diff --git a/tests/Stats.py b/tests/Stats.py index b0c9ac7..b186bf9 100755 --- a/tests/Stats.py +++ b/tests/Stats.py @@ -1,4 +1,4 @@ -from __future__ import division, absolute_import, print_function + import math diff --git a/tests/testCentroid.py b/tests/testCentroid.py index 2bbc884..9574c8e 100755 --- a/tests/testCentroid.py +++ b/tests/testCentroid.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division, absolute_import, print_function + """Test PyGuide.centroid with masked data. History: @@ -86,7 +86,7 @@ nPts = ctrData.pix print("meas err = %6.2f, %6.2f; est err = %.2f, %.2f; nCounts = %.0f; nPts = %d" % (measCtr[0] - actCtr[0], measCtr[1] - actCtr[1], ctrData.xyErr[0], ctrData.xyErr[1], nCounts, nPts)) - mask = numpy.zeros(arrShape, numpy.bool) + mask = numpy.zeros(arrShape, numpy.bool_) for row in range(maskLim[0], maskLim[1]+1): mask[row,:] = 1 ctrData = PyGuide.centroid( diff --git a/tests/testCentroidLong.py b/tests/testCentroidLong.py index 1ec3e5b..cc4fb3c 100755 --- a/tests/testCentroidLong.py +++ b/tests/testCentroidLong.py @@ -35,7 +35,7 @@ imShape = (ImWidth, ImWidth) nomCtr = (ImWidth // 2, ImWidth // 2) -mask = numpy.zeros(imShape, numpy.bool) +mask = numpy.zeros(imShape, numpy.bool_) NaN = float("NaN") # settings @@ -44,36 +44,36 @@ MaskWidthsPerFWHM = (0.0, 0.5, 1.0, 1.5, 2.0) # fractions of a FWHM NumTries = 20 -print "Compare centroid actual error vs estimated error" -print "over a range of fake data" -print -print "Settings:" -print "Thresh =", Thresh -print "Sky =", Sky, "ADU" -print "Read Noise =", CCDInfo.readNoise, "e-" -print "CCD Gain =", CCDInfo.ccdGain, "e-/ADU" -print "Bias =", CCDInfo.bias, "ADU" -print "Amplitudes =", AmplValues, "ADU" -print "FWHMs =", FWHMValues, "pixels" -print "Mask Widths =", MaskWidthsPerFWHM, "fractions of a FWHM" -print "Num Ctrs =", NumTries, "number of centroids per star shape" -print "CCD Size =", ImWidth, "x", ImWidth, "pixels" -print -print "the equation being minimized is:" -print " sum(var(r) * numPts(r))" -print "though the final number reported is a normalized version:" -print " asymm = sum(var(r) * numPts(r)) / (pixNoise^2 * totPts)" -print "where" -print " pixNoise is the noise/pixel due to read noise and sky" -print " totPts = sum(numPts(r))" -print -print "The centroids are randomly distributed over" -print "a range of -FWHM/2, FWHM/2 with respect to the" -print "center of the CCD = the center of the slit." -print -print "The slit is along y so the error along y should be smaller than x." -print -print "fwhm ampl maskWid xErr yErr xUncert yUncert asymm totPix totCts rad msgs" +print("Compare centroid actual error vs estimated error") +print("over a range of fake data") +print() +print("Settings:") +print("Thresh =", Thresh) +print("Sky =", Sky, "ADU") +print("Read Noise =", CCDInfo.readNoise, "e-") +print("CCD Gain =", CCDInfo.ccdGain, "e-/ADU") +print("Bias =", CCDInfo.bias, "ADU") +print("Amplitudes =", AmplValues, "ADU") +print("FWHMs =", FWHMValues, "pixels") +print("Mask Widths =", MaskWidthsPerFWHM, "fractions of a FWHM") +print("Num Ctrs =", NumTries, "number of centroids per star shape") +print("CCD Size =", ImWidth, "x", ImWidth, "pixels") +print() +print("the equation being minimized is:") +print(" sum(var(r) * numPts(r))") +print("though the final number reported is a normalized version:") +print(" asymm = sum(var(r) * numPts(r)) / (pixNoise^2 * totPts)") +print("where") +print(" pixNoise is the noise/pixel due to read noise and sky") +print(" totPts = sum(numPts(r))") +print() +print("The centroids are randomly distributed over") +print("a range of -FWHM/2, FWHM/2 with respect to the") +print("center of the CCD = the center of the slit.") +print() +print("The slit is along y so the error along y should be smaller than x.") +print() +print("fwhm ampl maskWid xErr yErr xUncert yUncert asymm totPix totCts rad msgs") nBad = 0 ctrXStats = Stats() @@ -110,29 +110,29 @@ doSmooth = DoSmooth, ) if not ctrData.isOK: - print "%s %s %s NaN NaN NaN NaN NaN NaN NaN %s %r" % ( + print("%s %s %s NaN NaN NaN NaN NaN NaN NaN %s %r" % ( fwhm, ampl, maskWidth, ctrData.rad, ctrData.msgStr, - ) + )) nBad += 1 continue xyMeasErr = [ctrData.xyCtr[ii] - actCtr[ii] for ii in (0,1)] - print "%s %s %s %.3f %.3f %.3f %.3f %.3f %s %s %s %r" % ( + print("%s %s %s %.3f %.3f %.3f %.3f %.3f %s %s %s %r" % ( fwhm, ampl, maskWidth, xyMeasErr[0], xyMeasErr[1], ctrData.xyErr[0], ctrData.xyErr[1], ctrData.asymm, ctrData.pix, ctrData.counts, ctrData.rad, ctrData.msgStr, - ) + )) ctrXStats.append(xyMeasErr[0]) ctrYStats.append(xyMeasErr[1]) -print -print "Error statistics (for %d points)" % ctrXStats.nPoints() -print " min max mean stdDev" -print "xErr %8.1f %8.1f %8.1f %8.1f" % (ctrXStats.min(), ctrXStats.max(), ctrXStats.mean(), ctrXStats.stdDev()) -print "yErr %8.1f %8.1f %8.1f %8.1f" % (ctrYStats.min(), ctrYStats.max(), ctrYStats.mean(), ctrYStats.stdDev()) +print() +print("Error statistics (for %d points)" % ctrXStats.nPoints()) +print(" min max mean stdDev") +print("xErr %8.1f %8.1f %8.1f %8.1f" % (ctrXStats.min(), ctrXStats.max(), ctrXStats.mean(), ctrXStats.stdDev())) +print("yErr %8.1f %8.1f %8.1f %8.1f" % (ctrYStats.min(), ctrYStats.max(), ctrYStats.mean(), ctrYStats.stdDev())) if nBad > 0: - print - print "number of failures =", nBad + print() + print("number of failures =", nBad) diff --git a/tests/testStarShape.py b/tests/testStarShape.py index 05438d4..12abbf0 100755 --- a/tests/testStarShape.py +++ b/tests/testStarShape.py @@ -20,7 +20,7 @@ import os.path import sys import PyGuide -import pyfits +from astropy.io import fits as pyfits # these values are probably wrong for the given test image CCDInfo = PyGuide.CCDInfo( @@ -50,7 +50,7 @@ #mask = data < 0 #mask[64:101, 78:92] = 1 -print "searching for stars" +print("searching for stars") ctrDataList, imStats = PyGuide.findStars( data = data, mask = mask, @@ -62,7 +62,7 @@ for ctrData in ctrDataList: xyCtr = ctrData.xyCtr rad = ctrData.rad - print "star xyCtr=%.2f, %.2f, radius=%s" % (xyCtr[0], xyCtr[1], rad) + print("star xyCtr=%.2f, %.2f, radius=%s" % (xyCtr[0], xyCtr[1], rad)) shapeData = PyGuide.starShape( data, @@ -71,8 +71,8 @@ rad = rad, ) if not shapeData.isOK: - print "starShape failed: %s" % (shapeData.msgStr,) + print("starShape failed: %s" % (shapeData.msgStr,)) else: - print "star ampl=%.1f, fwhm=%.1f, bkgnd=%.1f, chiSq=%.2f" %\ - (shapeData.ampl,shapeData.fwhm, shapeData.bkgnd, shapeData.chiSq) - print + print("star ampl=%.1f, fwhm=%.1f, bkgnd=%.1f, chiSq=%.2f" %\ + (shapeData.ampl,shapeData.fwhm, shapeData.bkgnd, shapeData.chiSq)) + print() diff --git a/tests/testStarShapeLong.py b/tests/testStarShapeLong.py index 5ae1029..6af6dd2 100755 --- a/tests/testStarShapeLong.py +++ b/tests/testStarShapeLong.py @@ -48,33 +48,33 @@ imShape = (ImWidth, ImWidth) nomCtr = (ImWidth // 2, ImWidth // 2) -mask = numpy.zeros(imShape, numpy.bool) +mask = numpy.zeros(imShape, numpy.bool_) -print "Compare star shape fit values to correct values" -print "over a range of fake data" -print -print "Settings:" -print "Sky =", Sky, "ADU" -print "Read Noise =", CCDInfo.readNoise, "e-" -print "CCD Gain =", CCDInfo.ccdGain, "e-/ADU" -print "Bias =", CCDInfo.bias, "ADU" -print "DoCentroid =", DoCentroid +print("Compare star shape fit values to correct values") +print("over a range of fake data") +print() +print("Settings:") +print("Sky =", Sky, "ADU") +print("Read Noise =", CCDInfo.readNoise, "e-") +print("CCD Gain =", CCDInfo.ccdGain, "e-/ADU") +print("Bias =", CCDInfo.bias, "ADU") +print("DoCentroid =", DoCentroid) if DoCentroid: - print "Thresh =", Thresh -print "Amplitudes =", AmplValues, "ADU" -print "FWHMs =", FWHMValues, "pixels" -print "Mask Widths =", MaskWidthsPerFWHM, "fractions of a FWHM" -print "Num Tries =", NumTries, "number of cases per star shape" -print "CCD Size =", ImWidth, "x", ImWidth, "pixels" -print -print "Each try is a star whose center is randomly distributed over" -print "a range of -FWHM/2, FWHM/2 with respect to the" -print "center of the CCD = the center of the slit." -print -print "Reported errors and statistics on these errors are in percent:" -print "reported error (%) = 100 * (meas value - act value) / act value" -print -print "The slit is along y." + print("Thresh =", Thresh) +print("Amplitudes =", AmplValues, "ADU") +print("FWHMs =", FWHMValues, "pixels") +print("Mask Widths =", MaskWidthsPerFWHM, "fractions of a FWHM") +print("Num Tries =", NumTries, "number of cases per star shape") +print("CCD Size =", ImWidth, "x", ImWidth, "pixels") +print() +print("Each try is a star whose center is randomly distributed over") +print("a range of -FWHM/2, FWHM/2 with respect to the") +print("center of the CCD = the center of the slit.") +print() +print("Reported errors and statistics on these errors are in percent:") +print("reported error (%) = 100 * (meas value - act value) / act value") +print() +print("The slit is along y.") def pctErr(meas, act): return (meas - act) * 100.0 / float(act) @@ -85,8 +85,8 @@ def pctErr(meas, act): nBadCtr = 0 nBad = 0 -print -print "fwhm ampl bg xCtr yCtr maskWid xCtMeas yCtMeas fitFWHM fitAmpl fitBg chiSq fwhmErr amplErr bgErr msgs" +print() +print("fwhm ampl bg xCtr yCtr maskWid xCtMeas yCtMeas fitFWHM fitAmpl fitBg chiSq fwhmErr amplErr bgErr msgs") bkgnd = Sky + CCDInfo.bias for ampl in AmplValues: for fwhm in FWHMValues: @@ -120,11 +120,11 @@ def pctErr(meas, act): thresh = Thresh, ) if not ctrData.isOK: - print "%.1f %.1f %.1f %.2f %.2f %.2f NaN NaN NaN NaN NaN NaN NaN NaN NaN %r" % ( + print("%.1f %.1f %.1f %.2f %.2f %.2f NaN NaN NaN NaN NaN NaN NaN NaN NaN %r" % ( fwhm, ampl, bkgnd, xyCtr[0], xyCtr[1], maskWidth, ctrData.msgStr, - ) + )) nBadCtr += 1 continue else: @@ -140,37 +140,37 @@ def pctErr(meas, act): rad = fwhm * 3, ) if not shapeData.isOK: - print "%.1f %.1f %.1f %.2f %.2f %.2f %.2f %.2f NaN NaN NaN NaN NaN NaN NaN %r" % ( + print("%.1f %.1f %.1f %.2f %.2f %.2f %.2f %.2f NaN NaN NaN NaN NaN NaN NaN %r" % ( fwhm, ampl, bkgnd, xyCtr[0], xyCtr[1], maskWidth, ctrData.xyCtr[0], ctrData.xyCtr[1], shapeData.msgStr, - ) + )) nBad += 1 continue fwhmErr = pctErr(shapeData.fwhm, fwhm) amplErr = pctErr(shapeData.ampl, ampl) bkgndErr = pctErr(shapeData.bkgnd, bkgnd) - print "%.1f %.1f %.1f %.2f %.2f %.2f %.2f %.2f %.1f %.1f %.1f %.2f %.1f %.1f %.1f %r" % ( + print("%.1f %.1f %.1f %.2f %.2f %.2f %.2f %.2f %.1f %.1f %.1f %.2f %.1f %.1f %.1f %r" % ( fwhm, ampl, bkgnd, xyCtr[0], xyCtr[1], maskWidth, ctrData.xyCtr[0], ctrData.xyCtr[1], shapeData.fwhm, shapeData.ampl, shapeData.bkgnd, shapeData.chiSq, fwhmErr, amplErr, bkgndErr, shapeData.msgStr, - ) + )) fwhmStats.append(fwhmErr) amplStats.append(amplErr) bkgndStats.append(bkgndErr) -print -print "Error statistics (for %d points)" % fwhmStats.nPoints() -print " min max mean stdDev" -print "fwhm %8.1f %8.1f %8.1f %8.1f" % (fwhmStats.min(), fwhmStats.max(), fwhmStats.mean(), fwhmStats.stdDev()) -print "ampl %8.1f %8.1f %8.1f %8.1f" % (amplStats.min(), amplStats.max(), amplStats.mean(), amplStats.stdDev()) -print "bkgnd %8.1f %8.1f %8.1f %8.1f" % (bkgndStats.min(), bkgndStats.max(), bkgndStats.mean(), bkgndStats.stdDev()) +print() +print("Error statistics (for %d points)" % fwhmStats.nPoints()) +print(" min max mean stdDev") +print("fwhm %8.1f %8.1f %8.1f %8.1f" % (fwhmStats.min(), fwhmStats.max(), fwhmStats.mean(), fwhmStats.stdDev())) +print("ampl %8.1f %8.1f %8.1f %8.1f" % (amplStats.min(), amplStats.max(), amplStats.mean(), amplStats.stdDev())) +print("bkgnd %8.1f %8.1f %8.1f %8.1f" % (bkgndStats.min(), bkgndStats.max(), bkgndStats.mean(), bkgndStats.stdDev())) if (nBad > 0) or (nBadCtr > 0): - print - print "number of shape fit failures =", nBad + print() + print("number of shape fit failures =", nBad) if DoCentroid: - print "number of centroid failures =", nBadCtr + print("number of centroid failures =", nBadCtr) diff --git a/tests/timeCentroid.py b/tests/timeCentroid.py index 6b38957..667891a 100755 --- a/tests/timeCentroid.py +++ b/tests/timeCentroid.py @@ -28,8 +28,8 @@ Ampl = 5000 def timeCentroid(data, mask, xyGuess, niter, rad=20): - print "timeCentroid: xyGuess=%3.0f, %3.0f; niter=%2d; rad=%3d;" % \ - (xyGuess[0], xyGuess[1], niter, rad), + print("timeCentroid: xyGuess=%3.0f, %3.0f; niter=%2d; rad=%3d;" % \ + (xyGuess[0], xyGuess[1], niter, rad), end=' ') begTime = time.time() for ii in range(niter): PyGuide.centroid( @@ -42,14 +42,14 @@ def timeCentroid(data, mask, xyGuess, niter, rad=20): ccdInfo = CCDInfo, ) dTime = time.time() - begTime - print "time/iter=%.3f" % (dTime/niter,) + print("time/iter=%.3f" % (dTime/niter,)) def timeRadAsymmWeighted(data, mask, niter, rad=20): - shape = data.getshape() - xc = shape[0]/2 - yc = shape[1]/2 - print "timeRadAsymmWeighted: niter=%2d; rad=%3d;" % (niter, rad), + shape = data.shape + xc = int(shape[0]/2) + yc = int(shape[1]/2) + print("timeRadAsymmWeighted: niter=%2d; rad=%3d;" % (niter, rad), end=' ') begTime = time.time() for ii in range(niter): @@ -58,15 +58,15 @@ def timeRadAsymmWeighted(data, mask, niter, rad=20): CCDInfo.bias, CCDInfo.readNoise, CCDInfo.ccdGain, ) dTime = time.time() - begTime - print "time/iter=%.3f" % (dTime/niter,) + print("time/iter=%.3f" % (dTime/niter,)) def timeRadProf(data, mask, niter, rad): """Time radProf and radSqProf""" - shape = data.getshape() - xc = shape[0]/2 - yc = shape[1]/2 - print "timeRadProf: niter=%2d; rad=%3d;" % (niter, rad,), + shape = data.shape + xc = int(shape[0]/2) + yc = int(shape[1]/2) + print("timeRadProf: niter=%2d; rad=%3d;" % (niter, rad,), end=' ') radSqLen = rad**2 + 1 radSqMean = numpy.zeros([radSqLen], numpy.float64) @@ -82,15 +82,15 @@ def timeRadProf(data, mask, niter, rad): for ii in range(niter): PyGuide.radProf.radSqProf(data, mask, (xc, yc), rad, radSqMean, radSqVar, radSqNPts) dTime = time.time() - begTime - print "radSqProf time/iter=%.4f;" % (dTime/niter,), + print("radSqProf time/iter=%.4f;" % (dTime/niter,), end=' ') begTime = time.time() for ii in range(niter): PyGuide.radProf.radProf(data, mask, (xc, yc), rad, radMean, radVar, radNPts) dTime = time.time() - begTime - print "radProf time/iter=%.4f" % (dTime/niter,), + print("radProf time/iter=%.4f" % (dTime/niter,), end=' ') - print + print() def runTests(): @@ -109,21 +109,21 @@ def runTests(): # let centroiding walk a bit to find the center xyGuess = numpy.add(xyCtr, (2, -2)) - print "Time various parts of centroiding as a function of radius" - print - print "Settings:" - print "CCD Size =", ImWidth, "x", ImWidth, "pix" - print "Star center = %d, %d pix" % (xyCtr[0], xyCtr[1]) - print "Initial guess = %d, %d pix" % (xyGuess[0], xyGuess[1]) - print - print "Amplitude =", Ampl, "ADU" - print "FWHM =", FWHM, "pix" - print "Sky =", Sky, "ADU" - print "Bias =", CCDInfo.bias, "ADU" - print "Read Noise =", CCDInfo.readNoise, "e-" - print "CCD Gain =", CCDInfo.ccdGain, "e-/ADU" + print("Time various parts of centroiding as a function of radius") + print() + print("Settings:") + print("CCD Size =", ImWidth, "x", ImWidth, "pix") + print("Star center = %d, %d pix" % (xyCtr[0], xyCtr[1])) + print("Initial guess = %d, %d pix" % (xyGuess[0], xyGuess[1])) + print() + print("Amplitude =", Ampl, "ADU") + print("FWHM =", FWHM, "pix") + print("Sky =", Sky, "ADU") + print("Bias =", CCDInfo.bias, "ADU") + print("Read Noise =", CCDInfo.readNoise, "e-") + print("CCD Gain =", CCDInfo.ccdGain, "e-/ADU") - allZerosMask = data.astype(numpy.bool) + allZerosMask = data.astype(numpy.bool_) allZerosMask[:] = 0 maskData = ( @@ -132,8 +132,8 @@ def runTests(): ) for mask, expl in maskData: - print - print expl + print() + print(expl) radNiterList = ( ( 10, 20), @@ -145,19 +145,19 @@ def runTests(): (640, 10), ) - print + print() for rad, niter in radNiterList: try: timeRadProf(data, mask, niter, rad) except Exception as e: - print "timeRadProf(niter=%s, rad=%s) failed: %s" % (niter, rad, e) + print("timeRadProf(niter=%s, rad=%s) failed: %s" % (niter, rad, e)) - print + print() for rad, niter in radNiterList: try: timeRadAsymmWeighted(data, mask, niter, rad) except Exception as e: - print "timeRadAsymmWeighted(niter=%s, rad=%s) failed: %s" % (niter, rad, e) + print("timeRadAsymmWeighted(niter=%s, rad=%s) failed: %s" % (niter, rad, e)) radNiterList = ( ( 10, 10), @@ -169,7 +169,7 @@ def runTests(): (640, 1), ) - print + print() for rad, niter in radNiterList: try: timeCentroid(data, mask, xyGuess, niter, rad) From 0a3e89c5277e22af92b971fa7e0f07b75fc9f24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavol=20Gajdo=C5=A1?= Date: Fri, 22 Nov 2024 19:03:28 +0100 Subject: [PATCH 4/4] Update README.txt --- README.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index ba05e9d..02e611e 100755 --- a/README.txt +++ b/README.txt @@ -1,4 +1,6 @@ PyGuide offers image analysis routines for telescope guiding, including a star finder, centroider and star shape fitter. -See doc/PyGuideManual.html for installation and usage instructions. \ No newline at end of file +See doc/PyGuideManual.html for installation and usage instructions. + +Modification of PyGuide code (https://github.com/fmerges/PyGuide and https://github.com/ApachePointObservatory/PyGuide) for python 3. Tested on python 3.12, numpy 1.26.0 and astropy 6.1.2. Need to use python3 version of RO package: https://github.com/pavolgaj/RO3/tree/main.