@@ -197,7 +197,7 @@ def smooth_image(model: Image, width=1.0):
197197 return cmodel
198198
199199
200- def calculate_image_frequency_moments (im : Image , reference_frequency = None , nmoments = 3 ) -> Image :
200+ def calculate_image_frequency_moments (im : Image , reference_frequency = None , nmoment = 3 ) -> Image :
201201 """Calculate frequency weighted moments
202202
203203 Weights are ((freq-reference_frequency)/reference_frequency)**moment
@@ -206,28 +206,28 @@ def calculate_image_frequency_moments(im: Image, reference_frequency=None, nmome
206206
207207 For example, to find the moments and then reconstruct from just the moments::
208208
209- moment_cube = calculate_image_frequency_moments(model_multichannel, nmoments =5)
209+ moment_cube = calculate_image_frequency_moments(model_multichannel, nmoment =5)
210210 reconstructed_cube = calculate_image_from_frequency_moments(model_multichannel, moment_cube)
211211
212212 :param im: Image cube
213213 :param reference_frequency: Reference frequency (default None uses average)
214- :param nmoments : Number of moments to calculate
214+ :param nmoment : Number of moments to calculate
215215 :return: Moments image
216216 """
217217 assert isinstance (im , Image )
218218 nchan , npol , ny , nx = im .shape
219219 channels = numpy .arange (nchan )
220220 freq = im .wcs .sub (['spectral' ]).wcs_pix2world (channels , 0 )[0 ]
221221
222- assert nmoments <= nchan , "Number of moments %d cannot exceed the number of channels %d" % (nmoments , nchan )
222+ assert nmoment <= nchan , "Number of moments %d cannot exceed the number of channels %d" % (nmoment , nchan )
223223
224224 if reference_frequency is None :
225225 reference_frequency = numpy .average (freq )
226226 log .debug ("calculate_image_frequency_moments: Reference frequency = %.3f (MHz)" % (reference_frequency / 1e6 ))
227227
228- moment_data = numpy .zeros ([nmoments , npol , ny , nx ])
228+ moment_data = numpy .zeros ([nmoment , npol , ny , nx ])
229229
230- for moment in range (nmoments ):
230+ for moment in range (nmoment ):
231231 for chan in range (nchan ):
232232 weight = numpy .power ((freq [chan ] - reference_frequency ) / reference_frequency , moment )
233233 moment_data [moment , ...] += im .data [chan , ...] * weight
@@ -251,7 +251,7 @@ def calculate_image_from_frequency_moments(im: Image, moment_image: Image, refer
251251
252252 For example, to find the moments and then reconstruct from just the moments::
253253
254- moment_cube = calculate_image_frequency_moments(model_multichannel, nmoments =5)
254+ moment_cube = calculate_image_frequency_moments(model_multichannel, nmoment =5)
255255 reconstructed_cube = calculate_image_from_frequency_moments(model_multichannel, moment_cube)
256256
257257
@@ -262,7 +262,7 @@ def calculate_image_from_frequency_moments(im: Image, moment_image: Image, refer
262262 """
263263 assert isinstance (im , Image )
264264 nchan , npol , ny , nx = im .shape
265- nmoments , mnpol , mny , mnx = moment_image .shape
265+ nmoment , mnpol , mny , mnx = moment_image .shape
266266
267267 assert npol == mnpol
268268 assert ny == mny
@@ -281,7 +281,7 @@ def calculate_image_from_frequency_moments(im: Image, moment_image: Image, refer
281281
282282 newim .data [...] = 0.0
283283
284- for moment in range (nmoments ):
284+ for moment in range (nmoment ):
285285 for chan in range (nchan ):
286286 weight = numpy .power ((freq [chan ] - reference_frequency ) / reference_frequency , moment )
287287 newim .data [chan , ...] += moment_image .data [moment , ...] * weight
0 commit comments