コード例 #1
0
ファイル: populatedb.py プロジェクト: edjoesu/clinamen
def fullupdateimages(verbose=False): 
	for ikey, iloc in filesettings.ACTIVE_IMG_LOCS.iteritems():
		for imgpath in filetools.get_files_in_dir(iloc):
			mod_time_file = os.lstat(imgpath).st_mtime
			mod_datetime = datetime.datetime.fromtimestamp(mod_time_file)
			imginfo=models.ImageInfo(path=imgpath, time=mod_datetime, loc_key=ikey)		
			imginfo.save() 
			imginfo.makeRawFrames()
			imginfo.getClosestSequence()
			imginfo.save()
			imginfo.ProcessImage()
			imginfo.save()
			if verbose:
				print imgpath
コード例 #2
0
ファイル: kapitzadirac.py プロジェクト: t1mur/odysseus
def main():
    ########################
    ### left lattice data ##
    ########################
    """Calibration done with lattice setpoint 944mV on scope"""
    leftcal_list = filetools.get_files_in_dir('.', globexpr='kdleft1*.xraw0')
    leftcal_list = filetools.sort_files_by_date(leftcal_list, newestfirst=False)

    leftroi=[slice(340, 475), slice(625, 650)]
    leftcount = []
    # time the lattice beam was pulsed on in us
    left_time_on = np.arange(2, 46, 2)

    leftcount = analyze_kapitzadirac(leftcal_list, left_time_on, leftroi)
    guess = [0.4, 1e4, 0, 100, 5e3]
    ans = fitfuncs.fit1dfunc(dampedsine, left_time_on, leftcount, guess)
    show_kd_result(left_time_on, leftcount, ans)
コード例 #3
0
ファイル: populatedb.py プロジェクト: edjoesu/clinamen
def updateimagesbytime(newestimgtime = None):
	if newestimgtime is None:
		newestimgtime = models.ImageInfo.objects.order_by('-time')[0].time
	
	for ikey, iloc in filesettings.ACTIVE_IMG_LOCS.iteritems():
		for imgpath in filetools.get_files_in_dir(iloc):
			mod_time_file = os.lstat(imgpath).st_mtime
			mod_datetime = datetime.datetime.fromtimestamp(mod_time_file)
			if mod_datetime > newestimgtime:
				imginfo, created=models.ImageInfo.objects.get_or_create(path=imgpath)
				if created:
					imginfo.time=mod_datetime
					imginfo.loc_key=ikey
					imginfo.save() 
					imginfo.makeRawFrames()
					imginfo.getClosestSequence()
					imginfo.save()
					if imginfo.imgtype is not None:
						imginfo.ProcessImage()
					imginfo.save()	
コード例 #4
0
ファイル: run_examples.py プロジェクト: t1mur/odysseus
#!/usr/bin/env python
"""Run all examples in the example directory

If an example fails, an error is raised. This is useful when checking if
everything still works the way it is supposed to.

"""

import subprocess

import filetools


dirname = '.'

# get all the names of python files
examples = filetools.get_files_in_dir('.', globexpr='example_*.py')

for example in examples:
    print '\n', 'running ', example
    retcode = subprocess.call(['python', example])

    if retcode:
        print '\n', 'An error occurred while running: '.upper(), example, '\n'
        raise RuntimeError





コード例 #5
0
ファイル: test_filetools.py プロジェクト: t1mur/odysseus
 def test_get_files_in_dir_args(self):
     curdirlist = filetools.get_files_in_dir(os.curdir, ext='py',
                                             globexpr='*.py', sort=False)
     assert isinstance(curdirlist, list)
コード例 #6
0
ファイル: test_filetools.py プロジェクト: t1mur/odysseus
 def test_get_files_in_dir_returntype(self):
     curdirlist = filetools.get_files_in_dir(os.curdir)
     assert isinstance(curdirlist, list)
コード例 #7
0
ファイル: example_filetools.py プロジェクト: t1mur/odysseus
import filetools


dirname = 'datafiles'

# get all the names of files with extension .TIF, by default sorted by date
imgnames = filetools.get_files_in_dir(dirname)
print imgnames

# get all the names of python files
pythonnames = filetools.get_files_in_dir('..', globexpr='*.py', sort=False)
# sort files by date, newest first
pythonnames_sorted = filetools.sort_files_by_date(pythonnames, newestfirst=True)

for pyname in pythonnames_sorted:
    print pyname