本文整理汇总了Python中sunpy.database.tables.DatabaseEntry类的典型用法代码示例。如果您正苦于以下问题:Python DatabaseEntry类的具体用法?Python DatabaseEntry怎么用?Python DatabaseEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DatabaseEntry类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_tags_unique
def test_tags_unique(database):
entry = DatabaseEntry()
entry.tags = [Tag('foo')]
database.add(entry)
database.commit()
entry.tags.append(Tag('foo'))
with pytest.raises(sqlalchemy.orm.exc.FlushError):
database.commit()
示例2: test_unstar_undo
def test_unstar_undo(database):
entry = DatabaseEntry()
entry.starred = True
database.unstar(entry)
assert not entry.starred
database.undo()
assert entry.starred
database.redo()
assert not entry.starred
示例3: test_entry_from_qr_block_with_missing_physobs
def test_entry_from_qr_block_with_missing_physobs(qr_block_with_missing_physobs):
entry = DatabaseEntry._from_query_result_block(qr_block_with_missing_physobs)
expected_entry = DatabaseEntry(
source='STEREO_A', provider='SSC',
fileid='swaves/2013/swaves_average_20130805_a_hfr.dat',
observation_time_start=datetime(2013, 8, 5),
observation_time_end=datetime(2013, 8, 6), instrument='SWAVES',
size=3601.08, wavemin=2398339664000.0, wavemax=18737028625.0)
assert entry == expected_entry
示例4: test_entry_from_qr_block
def test_entry_from_qr_block(query_result):
entry = DatabaseEntry._from_query_result_block(query_result[0])
expected_entry = DatabaseEntry(
source='SOHO', provider='SDAC', physobs='intensity',
fileid='/archive/soho/private/data/processed/eit/lz/2001/01/efz20010101.010014',
observation_time_start=datetime(2001, 1, 1, 1, 0, 14),
observation_time_end=datetime(2001, 1, 1, 1, 0, 21),
instrument='EIT', size=2059.0, wavemin=17.1, wavemax=17.1)
assert entry == expected_entry
示例5: test_from_fido_search_result_block
def test_from_fido_search_result_block(fido_search_result):
entry = DatabaseEntry._from_fido_search_result_block(
fido_search_result[0, 0][0].get_response(0)[0])
expected_entry = DatabaseEntry(
source='Proba2', provider='esa', physobs='irradiance',
fileid='http://proba2.oma.be/lyra/data/bsd/2012/01/01/lyra_20120101-000000_lev2_std.fits',
observation_time_start=datetime(2012, 1, 1, 0, 0),
observation_time_end=datetime(2012, 1, 2, 0, 0),
wavemin=np.nan, wavemax=np.nan,
instrument='lyra')
assert entry == expected_entry
示例6: test_entry_from_qr_block_kev
def test_entry_from_qr_block_kev(qr_block_with_kev_unit):
# See issue #766.
entry = DatabaseEntry._from_query_result_block(qr_block_with_kev_unit)
assert entry.source == 'RHESSI'
assert entry.provider == 'LSSP'
assert entry.fileid == '/hessidata/2011/09/20/hsi_20110920_010920'
assert entry.observation_time_start == datetime(2011, 9, 20, 1, 9, 20)
assert entry.observation_time_end == datetime(2011, 9, 20, 2, 27, 40)
assert entry.instrument == 'RHESSI'
assert entry.size == -1
assert round(entry.wavemin, 3) == 0.413
assert round(entry.wavemax, 7) == 0.0000729
示例7: test_entry_from_qr_block_kev
def test_entry_from_qr_block_kev(qr_block_with_kev_unit):
# See issue #766.
entry = DatabaseEntry._from_query_result_block(qr_block_with_kev_unit)
assert entry.source == 'RHESSI'
assert entry.provider == 'LSSP'
# TODO: Flaky test that needs a fix
assert entry.fileid in ['/hessidata/2011/09/19/hsi_20110919_233340',
'/hessidata/2011/09/20/hsi_20110920_010920']
assert entry.observation_time_start in [datetime(2011, 9, 20, 1, 9, 20),
datetime(2011, 9, 19, 23, 33, 40)]
assert entry.observation_time_end in [datetime(2011, 9, 20, 2, 27, 40),
datetime(2011, 9, 20, 1, 9, 20)]
assert entry.instrument == 'RHESSI'
assert round(entry.wavemin, 3) == 0.413
assert round(entry.wavemax, 7) == 0.0000729