當前位置: 首頁>>代碼示例>>Python>>正文


Python interval.IntervalIndexer類代碼示例

本文整理匯總了Python中vis.analyzers.indexers.interval.IntervalIndexer的典型用法代碼示例。如果您正苦於以下問題:Python IntervalIndexer類的具體用法?Python IntervalIndexer怎麽用?Python IntervalIndexer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IntervalIndexer類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_int_indexer_short_14

 def test_int_indexer_short_14(self):
     expected = [[(0.0, interval.Interval(note.Note('G3'), note.Note('G4')).name),
                  (0.0625, interval.Interval(note.Note('G3'), note.Note('G4')).name),
                  (0.125, u'Rest'),
                  (0.1875, u'Rest'),
                  (0.25, interval.Interval(note.Note('A3'), note.Note('G4')).name),
                  (0.3125, interval.Interval(note.Note('A3'), note.Note('G4')).name),
                  (0.375, u'Rest'),
                  (0.4375, u'Rest'),
                  (0.5, interval.Interval(note.Note('G3'), note.Note('G4')).name)]]
     expected = {'0,1': pandas_maker(expected)[0]}
     not_processed = [[(0.0, u'G4', 0.0625), (0.0625, u'G4', 0.0625),
                       (0.125, u'G4', 0.0625), (0.1875, u'G4', 0.0625),
                       (0.25, u'G4', 0.0625), (0.3125, u'G4', 0.0625),
                       (0.375, u'G4', 0.0625), (0.4375, u'G4', 0.0625),
                       (0.5, u'G4')],
                      [(0.0, u'G3', 0.125), (0.125, u'Rest', 0.125), (0.25, u'A3', 0.125),
                       (0.375, u'Rest', 0.0625), (0.4375, u'Rest', 0.0625), (0.5, u'G3')]]
     test_in = pandas_maker(not_processed)
     int_indexer = IntervalIndexer(test_in,
                                   {u'quality': True, u'simple or compound': u'compound'})
     actual = int_indexer.run()[u'interval.IntervalIndexer']
     self.assertEqual(len(expected), len(actual.columns))
     for key in expected.iterkeys():
         self.assertTrue(key in actual)
         self.assertSequenceEqual(list(expected[key].index), list(actual[key].index))
         self.assertSequenceEqual(list(expected[key]), list(actual[key]))
開發者ID:ELVIS-Project,項目名稱:fiddle-tunes,代碼行數:27,代碼來源:test_interval_indexer.py

示例2: test_int_indexer_short_1

 def test_int_indexer_short_1(self):
     expected = [(0.0, interval.Interval(note.Note('G3'), note.Note('G4')).name)]
     expected = TestIntervalIndexerShort.pandas_maker([expected])[0]
     not_processed = [[(0.0, u'G4')], [(0.0, u'G3')]]
     test_in = TestIntervalIndexerShort.pandas_maker(not_processed)
     int_indexer = IntervalIndexer(test_in,
                                   {u'quality': True, u'simple or compound': u'compound'})
     actual = int_indexer.run()[u'0,1']
     self.assertSequenceEqual(list(expected.index), list(actual.index))
     self.assertSequenceEqual(list(expected.values), list(actual.values))
開發者ID:willingc,項目名稱:vis,代碼行數:10,代碼來源:test_interval_indexer.py

示例3: test_interval_indexer_4

 def test_interval_indexer_4(self):
     # BWV7.7: small soprano and bass parts; "simple" in settings, "quality" not
     test_parts = [self.bwv77_s_small, self.bwv77_b_small]
     expected = TestIntervalIndexerLong.bwv77_S_B_small_simple_noqual
     setts = {u'simple or compound': u'simple'}
     int_indexer = IntervalIndexer(test_parts, setts)
     actual = int_indexer.run()[u'0,1']
     self.assertEqual(len(expected), len(actual))
     for i, ind in enumerate(list(actual.index)):
         self.assertEqual(expected[i][0], ind)
         self.assertEqual(expected[i][1], actual[ind])
開發者ID:willingc,項目名稱:vis,代碼行數:11,代碼來源:test_interval_indexer.py

示例4: test_interval_indexer_1

 def test_interval_indexer_1(self):
     # BWV7.7: full soprano and bass parts
     test_parts = [self.bwv77_soprano, self.bwv77_bass]
     expected = TestIntervalIndexerLong.bwv77_S_B_basis
     setts = {u'simple or compound': u'compound', u'quality': True}
     int_indexer = IntervalIndexer(test_parts, setts)
     actual = int_indexer.run()[u'0,1']
     self.assertEqual(len(expected), len(actual))
     for i, ind in enumerate(list(actual.index)):
         self.assertEqual(expected[i][0], ind)
         self.assertEqual(expected[i][1], actual[ind])
開發者ID:willingc,項目名稱:vis,代碼行數:11,代碼來源:test_interval_indexer.py

示例5: test_interval_indexer_4

 def test_interval_indexer_4(self):
     # BWV7.7: small soprano and bass parts; "simple" in settings, "quality" not
     test_parts = [self.bwv77_s_small, self.bwv77_b_small]
     expected = {'0,1': make_series(TestIntervalIndexerLong.bwv77_S_B_small_simple_noqual)}
     setts = {u'simple or compound': u'simple'}
     int_indexer = IntervalIndexer(test_parts, setts)
     actual = int_indexer.run()[u'interval.IntervalIndexer']
     self.assertEqual(len(expected), len(actual.columns))
     for key in expected.iterkeys():
         self.assertTrue(key in actual)
         self.assertSequenceEqual(list(expected[key].index), list(actual[key].index))
         self.assertSequenceEqual(list(expected[key]), list(actual[key]))
開發者ID:ELVIS-Project,項目名稱:fiddle-tunes,代碼行數:12,代碼來源:test_interval_indexer.py

示例6: test_interval_indexer_1

 def test_interval_indexer_1(self):
     # BWV7.7: full soprano and bass parts
     test_parts = [self.bwv77_soprano, self.bwv77_bass]
     expected = {'0,1': make_series(TestIntervalIndexerLong.bwv77_S_B_basis)}
     setts = {u'simple or compound': u'compound', u'quality': True}
     int_indexer = IntervalIndexer(test_parts, setts)
     actual = int_indexer.run()[u'interval.IntervalIndexer']
     self.assertEqual(len(expected), len(actual.columns))
     for key in expected.iterkeys():
         self.assertTrue(key in actual)
         self.assertSequenceEqual(list(expected[key].index), list(actual[key].index))
         self.assertSequenceEqual(list(expected[key]), list(actual[key]))
開發者ID:ELVIS-Project,項目名稱:fiddle-tunes,代碼行數:12,代碼來源:test_interval_indexer.py

示例7: test_interval_indexer_3

 def test_interval_indexer_3(self):
     # BWV7.7: small soprano and bass parts; "simple" and "quality" not in settings, and the
     # settings are in fact not specified
     test_parts = [self.bwv77_s_small, self.bwv77_b_small]
     expected = TestIntervalIndexerLong.bwv77_S_B_small_compound_noqual
     #setts = {}
     int_indexer = IntervalIndexer(test_parts)
     actual = int_indexer.run()[u'0,1']
     self.assertEqual(len(expected), len(actual))
     for i, ind in enumerate(list(actual.index)):
         self.assertEqual(expected[i][0], ind)
         self.assertEqual(expected[i][1], actual[ind])
開發者ID:willingc,項目名稱:vis,代碼行數:12,代碼來源:test_interval_indexer.py

示例8: test_interval_indexer_3

 def test_interval_indexer_3(self):
     # BWV7.7: small soprano and bass parts; "simple" and "quality" not in settings, and the
     # settings are in fact not specified
     test_parts = [self.bwv77_s_small, self.bwv77_b_small]
     expected = {'0,1': make_series(TestIntervalIndexerLong.bwv77_S_B_small_compound_noqual)}
     # setts = {}
     int_indexer = IntervalIndexer(test_parts)
     actual = int_indexer.run()[u'interval.IntervalIndexer']
     self.assertEqual(len(expected), len(actual.columns))
     for key in expected.iterkeys():
         self.assertTrue(key in actual)
         self.assertSequenceEqual(list(expected[key].index), list(actual[key].index))
         self.assertSequenceEqual(list(expected[key]), list(actual[key]))
開發者ID:ELVIS-Project,項目名稱:fiddle-tunes,代碼行數:13,代碼來源:test_interval_indexer.py

示例9: run_my_task

    def run_my_task(self, inputs, settings, outputs):

        # Set execution settings.
        wrapper_settings = dict( [(k, settings[k]) for k in ('Simple or Compound Intervals', 'Interval Quality')] )
        execution_settings = dict()
        if wrapper_settings['Simple or Compound Intervals'] == 0:
            execution_settings['simple or compound'] = 'simple'
        else:
            execution_settings['simple or compound'] = 'compound'
        execution_settings['quality'] = wrapper_settings['Interval Quality']
        execution_settings['mp'] = False
        execution_settings['directed'] = True
        
        # Run.
        infile = inputs['NoteRest Interval Indexer Result'][0]['resource_path']
        outfile = outputs['Vertical Interval Indexer Result'][0]['resource_path']
        data = DataFrame.from_csv(infile, header = [0, 1]) # We know the first two rows constitute a MultiIndex
        vertical_intervals = IntervalIndexer(data, execution_settings).run()
        vertical_intervals.to_csv(outfile)

        return True
開發者ID:ELVIS-Project,項目名稱:vis-rodan,代碼行數:21,代碼來源:vertical_interval_indexer.py


注:本文中的vis.analyzers.indexers.interval.IntervalIndexer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。