88from astropy import units as u
99from astropy .coordinates import SkyCoord
1010
11- from arl .data .polarisation import Polarisation_Frame , Receptor_Frame
11+ from arl .data .polarisation import PolarisationFrame , ReceptorFrame
1212
1313log = logging .getLogger (__name__ )
1414
@@ -20,10 +20,10 @@ class Configuration:
2020 """
2121
2222 def __init__ (self , name = '' , data = None , location = None ,
23- names = "%s" , xyz = None , mount = "alt-az" , frame = None , receptor_frame = Receptor_Frame ("linear" )):
23+ names = "%s" , xyz = None , mount = "alt-az" , frame = None , receptor_frame = ReceptorFrame ("linear" )):
2424
2525 # Defaults
26- if data is None and not xyz is None :
26+ if data is None and xyz is not None :
2727 desc = [('names' , '<U6' ),
2828 ('xyz' , '<f8' , (3 ,)),
2929 ('mount' , '<U5' )]
@@ -75,8 +75,8 @@ class GainTable:
7575 """
7676
7777 def __init__ (self , data = None , gain : numpy .array = None , time : numpy .array = None , weight : numpy .array = None ,
78- residual : numpy .array = None , frequency : numpy .array = None , receptor_frame : Receptor_Frame = \
79- Receptor_Frame ("linear" )):
78+ residual : numpy .array = None , frequency : numpy .array = None ,
79+ receptor_frame : ReceptorFrame = ReceptorFrame ("linear" )):
8080 """ Create a gaintable from arrays
8181
8282 The definition of gain is:
@@ -89,7 +89,7 @@ def __init__(self, data=None, gain: numpy.array = None, time: numpy.array = None
8989 :param frequency:
9090 :returns: Gaintable
9191 """
92- if data is None and not gain is None :
92+ if data is None and gain is not None :
9393 nrec = receptor_frame .nrec
9494 nrows = gain .shape [0 ]
9595 nants = gain .shape [1 ]
@@ -113,29 +113,28 @@ def size(self):
113113 size = 0
114114 size += self .data .size * sys .getsizeof (self .data )
115115 return size / 1024.0 / 1024.0 / 1024.0
116-
116+
117117 @property
118118 def time (self ):
119119 return self .data ['time' ]
120120
121121 @property
122122 def gain (self ):
123123 return self .data ['gain' ]
124-
124+
125125 @property
126126 def weight (self ):
127127 return self .data ['weight' ]
128128
129129 @property
130130 def residual (self ):
131131 return self .data ['residual' ]
132-
132+
133133 @property
134134 def nants (self ):
135135 return self .data ['gain' ].shape [1 ]
136136
137137
138-
139138class Image :
140139 """Image class with Image data (as a numpy.array) and optionally the AstroPy WCS.
141140
@@ -169,10 +168,10 @@ def nchan(self): return self.data.shape[0]
169168
170169 @property
171170 def npol (self ): return self .data .shape [1 ]
172-
171+
173172 @property
174173 def nheight (self ): return self .data .shape [2 ]
175-
174+
176175 @property
177176 def nwidth (self ): return self .data .shape [3 ]
178177
@@ -184,18 +183,19 @@ def frequency(self):
184183 @property
185184 def shape (self ):
186185 return self .data .shape
187-
186+
188187 @property
189188 def phasecentre (self ): return SkyCoord (self .wcs .wcs .crval [0 ] * u .deg , self .wcs .wcs .crval [1 ] * u .deg )
190189
190+
191191class Skycomponent :
192192 """ A single Skycomponent with direction, flux, shape, and params for the shape
193193
194194 """
195195
196196 def __init__ (self ,
197197 direction = None , frequency = None , name = None , flux = None , shape = 'Point' ,
198- polarisation_frame = Polarisation_Frame ('stokesIQUV' ), ** kwargs ):
198+ polarisation_frame = PolarisationFrame ('stokesIQUV' ), ** kwargs ):
199199 """ Define the required structure
200200
201201 :param direction: SkyCoord
@@ -233,24 +233,13 @@ def __str__(self):
233233
234234 """
235235 s = "Skycomponent:\n "
236- s += "\t Flux: %s\n " % ( self .flux )
237- s += "\t Direction: %s\n " % ( self .direction )
238- s += "\t Shape: %s\n " % ( self .shape )
239- s += "\t Params: %s\n " % ( self .params )
240- s += "\t Polaristation frame %s\n " % ( self .polarisation_frame )
236+ s += "\t Flux: %s\n " % self .flux
237+ s += "\t Direction: %s\n " % self .direction
238+ s += "\t Shape: %s\n " % self .shape
239+ s += "\t Params: %s\n " % self .params
240+ s += "\t Polarisation frame %s\n " % self .polarisation_frame
241241 return s
242242
243-
244- class Skymodel :
245- """ A skymodel consisting of a list of images and a list of skycomponents
246-
247- """
248-
249- def __init__ (self ):
250- self .images = [] # collection of numpy arrays
251- self .components = [] # collection of SkyComponents
252-
253-
254243class Visibility :
255244 """ Visibility table class
256245
@@ -264,9 +253,8 @@ class Visibility:
264253
265254 def __init__ (self ,
266255 data = None , frequency = None , channel_bandwidth = None , phasecentre = None , configuration = None ,
267- uvw = None , time = None , antenna1 = None , antenna2 = None , polarisation = None ,
268- vis = None , weight = None , imaging_weight = None , integration_time = None ,
269- polarisation_frame = Polarisation_Frame ('stokesI' )):
256+ uvw = None , time = None , antenna1 = None , antenna2 = None , vis = None , weight = None , imaging_weight = None ,
257+ integration_time = None , polarisation_frame = PolarisationFrame ('stokesI' )):
270258 if data is None and vis is not None :
271259 if imaging_weight is None :
272260 imaging_weight = weight
@@ -293,7 +281,7 @@ def __init__(self,
293281 data ['vis' ] = vis
294282 data ['weight' ] = weight
295283 data ['imaging_weight' ] = imaging_weight
296-
284+
297285 self .data = data # numpy structured array
298286 self .phasecentre = phasecentre # Phase centre of observation
299287 self .configuration = configuration # Antenna/station configuration
@@ -312,7 +300,7 @@ def nvis(self):
312300 return self .data ['vis' ].shape [0 ]
313301
314302 @property
315- def uvw (self ): # In wavelengths in Visibility
303+ def uvw (self ): # In wavelengths in Visibility
316304 return self .data ['uvw' ]
317305
318306 @property
@@ -326,23 +314,23 @@ def v(self):
326314 @property
327315 def w (self ):
328316 return self .data ['uvw' ][:, 2 ]
329-
317+
330318 @property
331319 def time (self ):
332320 return self .data ['time' ]
333-
321+
334322 @property
335323 def integration_time (self ):
336324 return self .data ['integration_time' ]
337-
325+
338326 @property
339327 def frequency (self ):
340328 return self .data ['frequency' ]
341-
329+
342330 @property
343331 def channel_bandwidth (self ):
344332 return self .data ['channel_bandwidth' ]
345-
333+
346334 @property
347335 def antenna1 (self ):
348336 return self .data ['antenna1' ]
@@ -378,7 +366,7 @@ def __init__(self,
378366 data = None , frequency = None , channel_bandwidth = None , phasecentre = None , configuration = None ,
379367 uvw = None , time = None ,
380368 vis = None , weight = None , integration_time = None ,
381- polarisation_frame = Polarisation_Frame ('stokesI' )):
369+ polarisation_frame = PolarisationFrame ('stokesI' )):
382370 if data is None and vis is not None :
383371 ntimes = len (time )
384372 assert vis .shape == weight .shape
@@ -400,7 +388,6 @@ def __init__(self,
400388 data ['weight' ] = weight
401389
402390 self .data = data # numpy structured array
403- self .time = time
404391 self .frequency = frequency
405392 self .channel_bandwidth = channel_bandwidth
406393 self .phasecentre = phasecentre # Phase centre of observation
@@ -414,15 +401,15 @@ def size(self):
414401 for col in self .data .dtype .fields .keys ():
415402 size += self .data [col ].nbytes
416403 return size / 1024.0 / 1024.0 / 1024.0
417-
404+
418405 @property
419406 def nchan (self ):
420407 return self .data ['vis' ].shape [3 ]
421-
408+
422409 @property
423410 def npol (self ):
424411 return self .data ['vis' ].shape [4 ]
425-
412+
426413 @property
427414 def nants (self ):
428415 return self .data ['vis' ].shape [1 ]
@@ -446,15 +433,15 @@ def w(self):
446433 @property
447434 def vis (self ):
448435 return self .data ['vis' ]
449-
436+
450437 @property
451438 def weight (self ):
452439 return self .data ['weight' ]
453-
440+
454441 @property
455442 def integration_time (self ):
456443 return self .data ['integration_time' ]
457-
444+
458445 @property
459446 def nvis (self ):
460447 return self .data .size
@@ -475,8 +462,8 @@ def __str__(self):
475462
476463 """
477464 s = "Quality assessment:\n "
478- s += "\t Origin: %s\n " % ( self .origin )
479- s += "\t Context: %s\n " % ( self .context )
465+ s += "\t Origin: %s\n " % self .origin
466+ s += "\t Context: %s\n " % self .context
480467 s += "\t Data:\n "
481468 for dataname in self .data .keys ():
482469 s += "\t \t %s: %s\n " % (dataname , str (self .data [dataname ]))
0 commit comments