本文整理汇总了Python中sunpy.net.attr.Attr类的典型用法代码示例。如果您正苦于以下问题:Python Attr类的具体用法?Python Attr怎么用?Python Attr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Attr类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, start, end, near=None):
self.start = anytim(start)
self.end = anytim(end)
self.near = None if near is None else anytim(near)
_Range.__init__(self, start, end, self.__class__)
Attr.__init__(self)
开发者ID:DavidBerghmans,项目名称:sunpy,代码行数:7,代码来源:attrs.py
示例2: __init__
def __init__(self, start, end, near=None):
self.start = parse_time(start)
self.end = parse_time(end)
self.near = None if near is None else parse_time(near)
_Range.__init__(self, self.start, self.end, self.__class__)
Attr.__init__(self)
开发者ID:timmie,项目名称:sunpy,代码行数:7,代码来源:attrs.py
示例3: __init__
def __init__(self, start, end, near=None):
self.start = start
self.end = end
self.near = near
_Range.__init__(self, start, end, self.__class__)
Attr.__init__(self)
开发者ID:calexyoung,项目名称:sunpy,代码行数:7,代码来源:attrs.py
示例4: __init__
def __init__(self, start, end=None, near=None):
if end is None and not isinstance(start, _TimeRange):
raise ValueError("Specify start and end or start has to be a TimeRange")
if isinstance(start, _TimeRange):
self.start = start.start
self.end = start.end
else:
self.start = parse_time(start)
self.end = parse_time(end)
self.near = None if near is None else parse_time(near)
_Range.__init__(self, self.start, self.end, self.__class__)
Attr.__init__(self)
开发者ID:Alex-Ian-Hamilton,项目名称:sunpy,代码行数:13,代码来源:attrs.py
示例5: __init__
def __init__(self, start, end=None):
if end is None and not isinstance(start, _TimeRange):
raise ValueError("Specify start and end or start has to be a TimeRange")
if isinstance(start, _TimeRange):
self.start = start.start
self.end = start.end
else:
self.start = start if isinstance(start, astropyTime) else astropyTime(parse_time(start))
self.end = end if isinstance(end, astropyTime) else astropyTime(parse_time(end))
if self.start > self.end:
raise ValueError("End time must be after start time.")
_Range.__init__(self, self.start, self.end, self.__class__)
Attr.__init__(self)
开发者ID:bwgref,项目名称:sunpy,代码行数:15,代码来源:attrs.py
示例6: __init__
def __init__(self, wavemin, wavemax=None):
"""
Specifies the wavelength or spectral energy range of the detector.
Parameters
----------
wavemin : `~astropy.units.Quantity`
The lower bounds of the range.
wavemax : `~astropy.units.Quantity`
The upper bound of the range, if not specified it will default to
the lower bound.
Notes
-----
The VSO understands the 'wavelength' in one of three units, Angstroms,
kHz or keV. Therefore any unit which is directly convertible to these
units is valid input.
"""
if not wavemax:
wavemax = wavemin
if not all(isinstance(var, u.Quantity) for var in [wavemin, wavemax]):
raise TypeError("Wave inputs must be astropy Quantities")
if not all([wavemin.isscalar, wavemax.isscalar]):
raise ValueError("Both wavemin and wavemax must be scalar values")
# VSO just accept inputs as Angstroms, kHz or keV, the following
# converts to any of these units depending on the spectral inputs
# Note: the website asks for GHz, however it seems that using GHz
# produces weird responses on VSO.
supported_units = [u.AA, u.kHz, u.keV]
for unit in supported_units:
if wavemin.unit.is_equivalent(unit):
break
else:
unit = None
if unit is None:
raise u.UnitsError("This unit is not convertable to any of {}".format(supported_units))
self.min, self.max = sorted([wavemin.to(unit), wavemax.to(unit)])
self.unit = unit
Attr.__init__(self)
_Range.__init__(self, self.min, self.max, self.__class__)
开发者ID:drewleonard42,项目名称:sunpy,代码行数:47,代码来源:attrs.py
示例7: __init__
def __init__(self, label, value):
Attr.__init__(self)
self.label = label
self.value = value
开发者ID:Cadair,项目名称:sunpy,代码行数:4,代码来源:attrs.py
示例8: __init__
def __init__(self, value):
if not (isinstance(value, u.Quantity) or isinstance(value, list)):
raise TypeError("Wave inputs must be astropy Quantities")
Attr.__init__(self)
self.value = value
开发者ID:abigailStev,项目名称:sunpy,代码行数:6,代码来源:attrs.py
注:本文中的sunpy.net.attr.Attr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论