コード例 #1
0
ファイル: test_filename_steps.py プロジェクト: GiannisA/fabio
 def test_jump1(self):
     for name, res, num in [ [ "data0001.edf", "data99993.edf" , 99993 ],
             [ "bob1.edf", "bob0.edf", 0 ],
             [ "1.edf", "123456.edf" , 123456],
             [ "mydata001.mar2300.gz", "mydata003.mar2300.gz", 3 ],
             ]:
         self.assertEqual(res, fabio.jump_filename(name, num))
コード例 #2
0
ファイル: test_filename_steps.py プロジェクト: isaxs/fabio
 def test_jump1(self):
     for name, res, num in [
         ["data0001.edf", "data99993.edf", 99993],
         ["bob1.edf", "bob0.edf", 0],
         ["1.edf", "123456.edf", 123456],
         ["mydata001.mar2300.gz", "mydata003.mar2300.gz", 3],
     ]:
         self.assertEqual(res, fabio.jump_filename(name, num))
コード例 #3
0
 def jump(self, newnum, noconvert=False):
     #FIXME - convert ???
     newfilename = fabio.jump_filename(self.filename, newnum)
     try:
         self.__openimage(newfilename)  #try to open that file
     except IOError:
         msg = "No such file: %s " % (newfilename)
         raise IOError(msg)
     #image loaded ok
     self.filename = newfilename
     self.number = newnum
     return True
コード例 #4
0
 def prev(self, steps=1):
     newnum = self.number - steps
     newfilename = fabio.jump_filename(self.filename, newnum)
     if newfilename == self.filename:
         raise ValueError("new filename == old filename")
     try:
         self.__openimage(newfilename)  #try to open that file
     except IOError:
         newfilename = fabio.jump_filename(self.filename,
                                           newnum,
                                           padding=False)
         if newfilename == self.filename:
             raise ValueError("new filename == old filename")
         try:
             #that didn't work - so try the unpadded version
             self.openimage(newfilename)
         except IOError:
             msg = "No such file: %s " % (newfilename)
             raise IOError(msg)
     #image loaded ok
     self.filename = newfilename
     self.number = newnum
     return True
コード例 #5
0
 def next(self, steps=1):
     newnum = self.number + steps
     newfilename = fabio.jump_filename(self.filename, newnum)
     if newfilename == self.filename:
         raise ValueError("new filename == old filename")
     try:
         self.__openimage(newfilename)  #try to open that file
     except IOError:
         msg = "No such file: %s " % (newfilename)
         raise IOError(msg)
     #image loaded ok
     self.filename = newfilename
     self.number = newnum
     return True
コード例 #6
0
ファイル: testfilenames.py プロジェクト: toqduj/fabio
 def test_more_cases_jump(self):
     for nname, oname, num in MORE_CASES:
         name = fabio.jump_filename(oname, num)
         self.assertEqual(name, nname)
コード例 #7
0
 def test_more_cases_jump(self):
     for nname, oname, num in MORE_CASES:
         name = fabio.jump_filename(oname, num)
         self.assertEqual(name, nname)