本文整理匯總了Python中astropy.__version__方法的典型用法代碼示例。如果您正苦於以下問題:Python astropy.__version__方法的具體用法?Python astropy.__version__怎麽用?Python astropy.__version__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類astropy
的用法示例。
在下文中一共展示了astropy.__version__方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __version__
# 需要導入模塊: import astropy [as 別名]
# 或者: from astropy import __version__ [as 別名]
def __version__(self):
if self._version is None:
try:
import astropy
version = astropy.__version__
except ImportError:
version = NotAModule(self._name)
self._version = version
return self._version
示例2: run
# 需要導入模塊: import astropy [as 別名]
# 或者: from astropy import __version__ [as 別名]
def run(self):
required, optional = [], []
try:
import astropy
astropy_version = astropy.__version__
if LooseVersion(astropy_version) < LooseVersion('1.0'):
required.append('astropy 1.0+')
except:
required.append('astropy')
try:
import scipy
scipy_version = scipy.__version__
if LooseVersion(scipy_version) < LooseVersion('0.1'):
required.append('scipy 0.1+')
except:
required.append('scipy')
try:
import matplotlib
mpl_version = matplotlib.__version__
if LooseVersion(mpl_version) < LooseVersion('1.4.3'):
optional.append('matplotlib 1.4.3+')
except:
optional.append('matplotlib')
try:
import sympy
sympy_version = sympy.__version__
if LooseVersion(sympy_version) < LooseVersion('1.0'):
optional.append('sympy 1.0+')
except:
optional.append('sympy')
if required == []:
print('All required import dependencies satisfied.')
else:
print('NOTE: while all the build dependencies are satisfied, the following import dependencies')
print(' are still missing: %s.' % required)
print(' You will not be able to import phoebe before you install those dependencies.')
if optional == []:
print('All optional import dependencies satisfied.')
else:
print('NOTE: while all the build dependencies are satisfied, the following optional dependencies')
print(' are still missing: %s.' % optional)
print(' Some of the core phoebe functionality will be missing until you install those dependencies.')
示例3: _report
# 需要導入模塊: import astropy [as 別名]
# 或者: from astropy import __version__ [as 別名]
def _report(self):
wrapper = textwrap.TextWrapper(initial_indent=' ',
subsequent_indent=' ')
self._fileobj.write('\n')
self._writeln(f' fitsdiff: {__version__}')
self._writeln(f' a: {self.filenamea}\n b: {self.filenameb}')
if self.ignore_hdus:
ignore_hdus = ' '.join(sorted(self.ignore_hdus))
self._writeln(' HDU(s) not to be compared:\n{}'
.format(wrapper.fill(ignore_hdus)))
if self.ignore_hdu_patterns:
ignore_hdu_patterns = ' '.join(sorted(self.ignore_hdu_patterns))
self._writeln(' HDU(s) not to be compared:\n{}'
.format(wrapper.fill(ignore_hdu_patterns)))
if self.ignore_keywords:
ignore_keywords = ' '.join(sorted(self.ignore_keywords))
self._writeln(' Keyword(s) not to be compared:\n{}'
.format(wrapper.fill(ignore_keywords)))
if self.ignore_comments:
ignore_comments = ' '.join(sorted(self.ignore_comments))
self._writeln(' Keyword(s) whose comments are not to be compared'
':\n{}'.format(wrapper.fill(ignore_comments)))
if self.ignore_fields:
ignore_fields = ' '.join(sorted(self.ignore_fields))
self._writeln(' Table column(s) not to be compared:\n{}'
.format(wrapper.fill(ignore_fields)))
self._writeln(' Maximum number of different data values to be '
'reported: {}'.format(self.numdiffs))
self._writeln(' Relative tolerance: {}, Absolute tolerance: {}'
.format(self.rtol, self.atol))
if self.diff_hdu_count:
self._fileobj.write('\n')
self._writeln('Files contain different numbers of HDUs:')
self._writeln(' a: {}'.format(self.diff_hdu_count[0]))
self._writeln(' b: {}'.format(self.diff_hdu_count[1]))
if not self.diff_hdus:
self._writeln('No differences found between common HDUs.')
return
elif not self.diff_hdus:
self._fileobj.write('\n')
self._writeln('No differences found.')
return
for idx, hdu_diff in self.diff_hdus:
# print out the extension heading
if idx == 0:
self._fileobj.write('\n')
self._writeln('Primary HDU:')
else:
self._fileobj.write('\n')
self._writeln(f'Extension HDU {idx}:')
hdu_diff.report(self._fileobj, indent=self._indent + 1)
示例4: print_pkg_versions
# 需要導入模塊: import astropy [as 別名]
# 或者: from astropy import __version__ [as 別名]
def print_pkg_versions(packages=None, git=False, svn=False, log=None):
if log is not None:
def output(msg):
log.info(msg)
else:
def output(msg):
print(msg)
pkgs = ['numpy', 'astropy', 'stwcs']
if packages is not None:
if not isinstance(packages, list):
packages = [packages]
pkgs.extend(packages)
output('Version Information')
output('-' * 20)
sysver = sys.version.split('\n')
output('Python Version %s' % sysver.pop())
for ver in sysver:
output(ver)
for software in pkgs:
try:
package = __import__(software)
vstr = "%s "%(software)
try:
vstr+= "Version -> "+package.__version__+" "
except:
vstr += "No version defined. "
if svn:
git = True
#try:
# vstr += "\n SVN version -> "+package.__svn_version__.rstrip()
#except:
# vstr += " "
if git:
try:
vstr += "\n GIT version -> " + '-'.join([package.__version__, package.__version_post__, package.__version_commit]).rstrip()
except:
vstr += " "
except:
vstr = software+" not found in path..."
output(vstr)