def beep(duration=.5, frequency1=None, frequency2=None): if type(duration) in [tuple, list]: frequency2 = frequency1 frequency1 = duration duration =.5 if frequency1 == None: frequency1 = random.randrange(200, 10000) if type(frequency1) in [tuple, list]: if frequency2 == None: frequency2 = [None for i in range(len(frequency1))] for (f1, f2) in zip(frequency1, frequency2): if myro.globvars.robot: scribbler.Scribbler().beep(duration, f1, f2) # else: # computer.beep(duration, f1, f2) else: if scribbler.Scribbler(): scribbler.Scribbler().beep(duration, frequency1, frequency2)
If you use this tool for your own dataset, you *must* double check this pixel scale is correct! """ pixel_scales = 0.1 """ First, load the `Imaging` dataset, so that the location of galaxies is clear when scaling the noise-map. """ image = al.Array2D.from_fits( file_path=path.join(dataset_path, "image.fits"), pixel_scales=pixel_scales ) cmap = aplt.Cmap( norm="log", vmin=1.0e-4, vmax=0.4 * np.max(image), linthresh=0.05, linscale=0.1 ) scribbler = scribbler.Scribbler(image=image.native, cmap=cmap) mask = scribbler.show_mask() mask = al.Mask2D.manual(mask=mask, pixel_scales=pixel_scales) """ Here, we change the image flux values to zeros. If included, we add some random Gaussian noise to most close resemble noise in the image. """ background_level = al.preprocess.background_noise_map_from_edges_of_image( image=image, no_edges=2 )[0] # gaussian_sigma = None gaussian_sigma = 0.1 image = np.where(mask, 0.0, image.native)
def test(): print "Funciona la importacion" #return scribbler.Scribbler() return scribbler.Scribbler().env()
def getBattery(): return scribbler.Scribbler().getBattery()
def setLEDBack(value): return scribbler.Scribbler().setLEDBack(value)
def setLEDFront(value): return scribbler.Scribbler().setLEDFront(value)
def setLED(position, value): return scribbler.Scribbler().set("led", position, value)
def move(translate,rotate): return scribbler.Scribbler().move(translate,rotate)
def motors(left,right): return scribbler.Scribbler().motors(left,right)
""" dataset_name = "mass_sie__source_sersic" dataset_path = path.join("dataset", "imaging", "no_lens_light", dataset_name) """ If you use this tool for your own dataset, you *must* double check this pixel scale is correct! """ pixel_scales = 0.1 """ First, load the `Imaging` dataset, so that the mask can be plotted over the strong lens image. """ image = al.Array2D.from_fits(file_path=path.join(dataset_path, "image.fits"), pixel_scales=pixel_scales) """ Load the GUI for drawing the mask. Push Esc when you are finished drawing the mask. """ scribbler = scribbler.Scribbler(image=image.native) mask = scribbler.show_mask() mask = al.Mask2D.manual(mask=np.invert(mask), pixel_scales=pixel_scales) """ Now lets plot the image and mask, so we can check that the mask includes the regions of the image we want. """ visuals_2d = aplt.Visuals2D(mask=mask) array_2d_plotter = aplt.Array2DPlotter(array=image, visuals_2d=visuals_2d) array_2d_plotter.figure_2d() """ Now we`re happy with the mask, lets output it to the dataset folder of the lens, so that we can load it from a .fits file in our pipelines! """ mask.output_to_fits(file_path=path.join(dataset_path, "mask.fits"), overwrite=True)
'a': 440, 'cH': 523, 'eH': 659, 'fH': 698 } part1 = [[500, notes['a']], [500, notes['a']], [500, notes['a']], [350, notes['f']], [150, notes['cH']], [500, notes['a']], [350, notes['f']], [150, notes['cH']], [650, notes['a']]] part2 = [[500, notes['eH']], [500, notes['eH']], [500, notes['eH']], [350, notes['fH']], [150, notes['cH']], [500, notes['gS']], [350, notes['f']], [150, notes['cH']], [650, notes['a']]] if __name__ == '__main__': sc = s.Scribbler(DEVICE) ids = None # drive slowly forward sc.set_motors(-0.1, -0.1) # loop until a marker is detected while ids == None: jpeg = sc.capture_jpeg_data(True, s.JPEG_FAST) ids = detect_markers(jpeg_to_mat(jpeg)) first_marker = ids.flat[0] print('I found marker #%d' % first_marker) # stop the robot sc.set_motors(0, 0)