Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/imagemetadata.py: 58%
108 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
1# This file was automatically generated by SWIG (http://www.swig.org).
2# Version 3.0.12
3#
4# Do not make changes to this file unless you know what you are doing--modify
5# the SWIG interface file instead.
7from sys import version_info as _swig_python_version_info
8if _swig_python_version_info >= (2, 7, 0):
9 def swig_import_helper():
10 import importlib
11 pkg = __name__.rpartition('.')[0]
12 mname = '.'.join((pkg, '_imagemetadata')).lstrip('.')
13 try:
14 return importlib.import_module(mname)
15 except ImportError:
16 return importlib.import_module('_imagemetadata')
17 _imagemetadata = swig_import_helper()
18 del swig_import_helper
19elif _swig_python_version_info >= (2, 6, 0):
20 def swig_import_helper():
21 from os.path import dirname
22 import imp
23 fp = None
24 try:
25 fp, pathname, description = imp.find_module('_imagemetadata', [dirname(__file__)])
26 except ImportError:
27 import _imagemetadata
28 return _imagemetadata
29 try:
30 _mod = imp.load_module('_imagemetadata', fp, pathname, description)
31 finally:
32 if fp is not None:
33 fp.close()
34 return _mod
35 _imagemetadata = swig_import_helper()
36 del swig_import_helper
37else:
38 import _imagemetadata
39del _swig_python_version_info
41try:
42 _swig_property = property
43except NameError:
44 pass # Python < 2.2 doesn't have 'property'.
46try:
47 import builtins as __builtin__
48except ImportError:
49 import __builtin__
51def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
52 if (name == "thisown"):
53 return self.this.own(value)
54 if (name == "this"):
55 if type(value).__name__ == 'SwigPyObject':
56 self.__dict__[name] = value
57 return
58 method = class_type.__swig_setmethods__.get(name, None)
59 if method:
60 return method(self, value)
61 if (not static):
62 if _newclass:
63 object.__setattr__(self, name, value)
64 else:
65 self.__dict__[name] = value
66 else:
67 raise AttributeError("You cannot add attributes to %s" % self)
70def _swig_setattr(self, class_type, name, value):
71 return _swig_setattr_nondynamic(self, class_type, name, value, 0)
74def _swig_getattr(self, class_type, name):
75 if (name == "thisown"):
76 return self.this.own()
77 method = class_type.__swig_getmethods__.get(name, None)
78 if method:
79 return method(self)
80 raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
83def _swig_repr(self):
84 try:
85 strthis = "proxy of " + self.this.__repr__()
86 except __builtin__.Exception:
87 strthis = ""
88 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
90try:
91 _object = object
92 _newclass = 1
93except __builtin__.Exception:
94 class _object:
95 pass
96 _newclass = 0
98class imagemetadata(_object):
99 """Proxy of C++ casac::imagemetadata class."""
101 __swig_setmethods__ = {}
102 __setattr__ = lambda self, name, value: _swig_setattr(self, imagemetadata, name, value)
103 __swig_getmethods__ = {}
104 __getattr__ = lambda self, name: _swig_getattr(self, imagemetadata, name)
105 __repr__ = _swig_repr
107 def __init__(self):
108 """__init__(self) -> imagemetadata"""
109 this = _imagemetadata.new_imagemetadata()
110 try:
111 self.this.append(this)
112 except __builtin__.Exception:
113 self.this = this
115 def add(self, *args, **kwargs):
116 """
117 add(self, _key, _value) -> bool
121 Summary:
122 Add a key-value pair if possible.
124 Description:
127 Add a key-value pair if possible.
130 Input Parameters:
131 key The name of the FITS or other keyword.
132 value Associated value to add.
134 Example:
136 imd.open('myim.im')
137 # add a keyword 'test' with value 'first'
138 if add('test', 'first'):
139 print 'test=first has been added'
140 else:
141 print 'Unable to add key test'
142 imd.done()
144 --------------------------------------------------------------------------------
146 """
147 return _imagemetadata.imagemetadata_add(self, *args, **kwargs)
150 def close(self):
151 """
152 close(self) -> bool
156 Summary:
157 Close the image metadata tool. Synonym for done().
159 Description:
163 This function closes the image metadata tool. This means that it detaches the
164 tool from its underlying metadata object. Methods cannot be run on it until it
165 is opened with another or the same image.
167 Example:
169 imd.open('myim.im')
170 # do stuff
171 imd.close()
173 --------------------------------------------------------------------------------
175 """
176 return _imagemetadata.imagemetadata_close(self)
179 def done(self):
180 """
181 done(self) -> bool
185 Summary:
186 Close the image metadata tool. Synonym for close().
188 Description:
192 This function closes the image metadata tool. This means that it detaches the
193 tool from its underlying metadata object. Methods cannot be run on it until it
194 is opened with another or the same image.
198 Example:
200 imd.open('myim.im')
201 # do stuff
202 imd.done()
204 --------------------------------------------------------------------------------
206 """
207 return _imagemetadata.imagemetadata_done(self)
210 def get(self, *args, **kwargs):
211 """
212 get(self, _key) -> variant *
216 Summary:
217 Get the value associated with the specified, case-insensitive FITS keyword.
219 Description:
222 Get the value associated with the specified, case-insensitive FITS keyword.
225 Input Parameters:
226 key The name of the FITS or other keyword.
228 Example:
230 imd.open('myim.im')
231 imtype = imd.get('imtype')
232 imd.done()
234 --------------------------------------------------------------------------------
236 """
237 return _imagemetadata.imagemetadata_get(self, *args, **kwargs)
240 def list(self, *args, **kwargs):
241 """
242 list(self, _verbose) -> record *
246 Summary:
247 Get a dictionary of FITS-like header items.
249 Description:
252 Get a listing of traditional FITS-like 'header' items.
255 Input Parameters:
256 verbose If true, print listing to logger
258 Example:
260 imd.open('myim.im')
261 mylist = imd.list(False)
262 imd.done()
263 crval1 = mylist{'crval1'}
265 --------------------------------------------------------------------------------
267 """
268 return _imagemetadata.imagemetadata_list(self, *args, **kwargs)
271 def open(self, *args, **kwargs):
272 """
273 open(self, _infile) -> bool
277 Summary:
278 Open this image metadata tool providing access to an image's metadata.
280 Description:
284 This method creates access to the specified image's metadata.
288 Input Parameters:
289 infile Image name. The image can be in any casa supported format.
291 Example:
293 immd.open('myim.im')
294 # do stuff with the tool and then close it.
295 immd.done()
297 --------------------------------------------------------------------------------
299 """
300 return _imagemetadata.imagemetadata_open(self, *args, **kwargs)
303 def remove(self, *args, **kwargs):
304 """
305 remove(self, _key, _value) -> bool
309 Summary:
310 Remove or clear the value of a keyword if possible.
312 Description:
315 Remove or clear the value of a keyword if possible. If key='masks', a value specifying the mask
316 to remove may be specified. If no value is specified, all masks are removed.
319 Input Parameters:
320 key The name of the FITS or other keyword.
321 value Value to remove if the key is multi-valued. Only used in the case of key='masks'.
323 Example:
325 imd.open('myim.im')
326 # clear the brightness unit
327 if imd.remove('bunit'):
328 print 'bunit has been cleared'
329 else:
330 print 'Unable to clear bunit'
331 imd.done()
333 --------------------------------------------------------------------------------
335 """
336 return _imagemetadata.imagemetadata_remove(self, *args, **kwargs)
339 def set(self, *args, **kwargs):
340 """
341 set(self, _key, _value) -> bool
345 Summary:
346 Set a keyword to the specified value if possible.
348 Description:
351 Set a key-value pair if possible.
354 Input Parameters:
355 key The name of the FITS or other keyword.
356 value Associated value to set.
358 Example:
360 Note that when setting the reference value of a polarizaiton axis, one must
361 provide an array of stokes/polarization strings (['I', 'Q', 'XX']) that is the
362 same length as the stokes axis. If the stokes axis is degenerate, one can alternatively
363 provide a string indicating the stokes value.
365 imd.open('myim.im')
366 # Set keyword 'telescope' with value 'Argus Array'
367 if imd.set('telescope', 'Argus Array'):
368 print 'telescope has been updated'
369 else:
370 print 'Unable to update telescope.'
371 imd.done()
373 # set polarizations for an image with three pixels on the stokes axis crval3
374 imd.open('myim.im')
375 if imd.set('crval3', [XY, LL, 'Q']):
376 print 'polarization values have been updated'
377 else:
378 print 'Unable to update polarization values.'
379 imd.done()
381 --------------------------------------------------------------------------------
383 """
384 return _imagemetadata.imagemetadata_set(self, *args, **kwargs)
386 __swig_destroy__ = _imagemetadata.delete_imagemetadata
387 __del__ = lambda self: None
388imagemetadata_swigregister = _imagemetadata.imagemetadata_swigregister
389imagemetadata_swigregister(imagemetadata)
391# This file is compatible with both classic and new-style classes.