• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python array.Array类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pycbc.types.array.Array的典型用法代码示例。如果您正苦于以下问题:Python Array类的具体用法?Python Array怎么用?Python Array使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Array类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, initial_array, delta_t=None, epoch="", dtype=None, copy=True):
     if len(initial_array) < 1:
         raise ValueError('initial_array must contain at least one sample.')
     if delta_t is None:
         try:
             delta_t = initial_array.delta_t
         except AttributeError:
             raise TypeError('must provide either an initial_array with a delta_t attribute, or a value for delta_t')
     if not delta_t > 0:
         raise ValueError('delta_t must be a positive number')
     # We gave a nonsensical default value to epoch so we can test if it's been set.
     # If the user passes in an initial_array that has an 'epoch' attribute and doesn't
     # pass in a value of epoch, then our new object's epoch comes from initial_array.
     # But if the user passed in a value---even 'None'---that will take precedence over
     # anything set in initial_array.  Finally, if the user passes in something without
     # an epoch attribute *and* doesn't pass in a value of epoch, it becomes 'None'
     if not isinstance(epoch,_lal.LIGOTimeGPS):
         if epoch == "":
             if isinstance(initial_array, TimeSeries):
                 epoch = initial_array._epoch
             else:
                 epoch = _lal.LIGOTimeGPS(0)
         elif epoch is not None:
             try:
                 epoch = _lal.LIGOTimeGPS(epoch)
             except:
                 raise TypeError('epoch must be either None or a lal.LIGOTimeGPS')
     Array.__init__(self, initial_array, dtype=dtype, copy=copy)
     self._delta_t = delta_t
     self._epoch = epoch
开发者ID:bhooshan-gadre,项目名称:pycbc,代码行数:30,代码来源:timeseries.py


示例2: __getitem__

 def __getitem__(self, index):
     if isinstance(index, slice):
         # Set the new epoch---note that index.start may also be None
         if self._epoch is None:
             new_epoch = None
         elif index.start is None:
             new_epoch = self._epoch
         else:
             if index.start < 0:
                 raise ValueError('Negative start index not supported')
             new_epoch = self._epoch + index.start * self._delta_t
         return TimeSeries(Array.__getitem__(self, index), self._delta_t, new_epoch, copy=False)
     else:
         return Array.__getitem__(self, index)
开发者ID:gayathrigcc,项目名称:pycbc,代码行数:14,代码来源:timeseries.py


示例3: __getitem__

 def __getitem__(self, index):
     if isinstance(index, slice):
         # Set the new epoch---note that index.start may also be None
         if self._epoch is None:
             new_epoch = None
         elif index.start is None:
             new_epoch = self._epoch
         else:
             if index.start < 0:
                 index.start += len(self)
             new_epoch = self._epoch + index.start * self._delta_t
         return TimeSeries(Array.__getitem__(self, index), self._delta_t, new_epoch, copy=False)
     else:
         return Array.__getitem__(self, index)
开发者ID:AbhayMK,项目名称:pycbc,代码行数:14,代码来源:timeseries.py


示例4: _getslice

 def _getslice(self, index):
     if index.step is not None:
         new_delta_f = self._delta_f * index.step
     else:
         new_delta_f = self._delta_f
     return FrequencySeries(Array._getslice(self, index),
                            delta_f=new_delta_f,
                            epoch=self._epoch,
                            copy=False)
开发者ID:aburony1970,项目名称:pycbc,代码行数:9,代码来源:frequencyseries.py


示例5: _getslice

    def _getslice(self, index):
        # Set the new epoch---note that index.start may also be None
        if self._epoch is None:
            new_epoch = None
        elif index.start is None:
            new_epoch = self._epoch
        else:
            if index.start < 0:
                raise ValueError('Negative start index not supported')
            new_epoch = self._epoch + index.start * self._delta_t

        if index.step is not None:
            new_delta_t = self._delta_t * index.step
        else:
            new_delta_t = self._delta_t
        
        return TimeSeries(Array._getslice(self, index), new_delta_t,
                          new_epoch, copy=False)
开发者ID:cmbiwer,项目名称:pycbc,代码行数:18,代码来源:timeseries.py



注:本文中的pycbc.types.array.Array类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python core.make_analysis_dir函数代码示例发布时间:2022-05-25
下一篇:
Python types.TimeSeries类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap