How to use IM - 2 common examples

To help you get started, we’ve selected a few IM examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tvwerkhoven / libtim-py / libtim / cam.py View on Github external
else:
		CAM_CFG['handle'] = None

	if (roi):
		CAM_CFG['dshape'] = (roi[2], roi[3])
	elif (usecam):
		# GetSize returns (width, h), NumPy arrays expect (height, w)
		rawframe = cv.QueryFrame(CAM_CFG['handle'])
		CAM_CFG['dshape'] = cv.GetSize(rawframe)[::-1]
	else:
		raise ValueError("Need ROI or camera to determine data shape.")

	CAM_CFG['frame'] = cv.CreateImage(CAM_CFG['dshape'][::-1], cvdtype, 1)

	if (maskshape == 'circ'):
		CAM_CFG['mask'] = im.mk_rad_mask(*CAM_CFG['dshape']) < 1
	else:
		CAM_CFG['mask'] = np.ones(CAM_CFG['dshape']).astype(np.bool)
	CAM_CFG['imask'] = (CAM_CFG['mask'] == False)

	file.store_file(pjoin(outdir, CAM_APTMASK), CAM_CFG['mask'].astype(np.uint8), clobber=True)

	if (verb&VERB_M > L_INFO):  print "Camera setup complete..."

	cam_getimage(show=True)
github tvwerkhoven / libtim-py / libtim / ao.py View on Github external
# be (n_act, n_meas). We should have:
	# n_data > n_meas
	# n_meas > n_act
	n_data, n_meas1 = measmat.shape
	n_act, n_meas2 = actmat.shape
	assert (n_data > n_meas1), "Measurement matrix wrong, transposed?"
	assert (n_meas2 > n_act), "Actuation matrix wrong, transposed?"
	assert (n_meas2 == n_meas1), "Matrices incompatible, not the same number of measurements"

	if infldat == None: 
		infldat = comp_influence(measmat, actmat)
	
	svd_U, svd_s, svd_Vh = infldat['svdcomps']
	offsetmeas = infldat['offsetmeas'].ravel()
	dshape = apt_mask.shape
	apt_mask_c = im.mk_rad_mask(*dshape) < 0.9
	plot_mask = np.ones(apt_mask.shape)
	plot_mask[apt_mask==False] = np.nan

	if (what in ["all", "singval"]):
		plt.figure(fignum0+100); plt.clf()
		plt.title("Singvals (n=%d, sum=%.4g, c=%.4g)" % (len(svd_s), svd_s.sum(), svd_s[0]/svd_s[-1]))
		plt.xlabel("Mode [#]")
		plt.ylabel("Singular value [AU]")
		plt.plot(svd_s)
		if (store): plt.savefig(pjoin(outdir, "cal_singvals.pdf"))

		plt.figure(fignum0+101); plt.clf()
		plt.title("Singvals [log] (n=%d, sum=%.4g, c=%.4g)" % (len(svd_s), svd_s.sum(), svd_s[0]/svd_s[-1]))
		plt.xlabel("Mode [#]")
		plt.ylabel("Singular value [AU]")
		plt.semilogy(svd_s)

IM

IM is a tool to manage virtual infrastructures on Cloud deployments

GPL-3.0
Latest version published 16 days ago

Package Health Score

78 / 100
Full package analysis

Popular IM functions

Similar packages