How to use _stopTracking method in fMBT

Best Python code snippet using fMBT_python

autoskyflat.py

Source:autoskyflat.py Github

copy

Full Screen

...107 site['latitude'], site.LST()))108 if tracking:109 self._startTracking()110 else:111 self._stopTracking()112 except:113 self.log.debug("Error moving the telescope")114 def _stopTracking(self):115 """116 disables telescope tracking117 """118 tel = self._getTel()119 try:120 self.log.debug("Skyflat is stopping telescope tracking")121 tel.stopTracking()122 except:123 self.log.debug("Error stopping the telescope")124 def _startTracking(self, wait=True):125 """126 enables telescope tracking127 """128 tel = self._getTel()129 try:130 self.log.debug("Skyflat is restarting telescope tracking")131 tel.startTracking()132 if wait:133 while 1:134 if tel.isTracking():135 return136 except:137 self.log.debug("Error starting the telescope")138 def getFlats(self, filter_id, n_flats=None, request=None):139 """140 Take flats on filter_id filter.141 * 1 - Wait for the Sun to enter the altitude strip where we can take skyflats142 * 2 - Take first image to guess exponential scaling factor143 * 3 - Measure exponential scaling factor144 * 4 - Compute exposure time145 * 5 - Take flat146 * 6 - Goto 2 until reaches n_flats147 :param filter_id: Filter name to take the Flats148 :param n_flats: Number of flats to take. None for maximum on the sun interval.149 :param request: Additional keywords to pass to ImageRequest.150 """151 # Read fresh coefficients from file.152 self.scale, self.slope, self.bias = self.readCoefficientsFile(self['coefficients_file'])[filter_id]153 self.log.debug('Skyflat parameters: n_flats = %i, filter = %s, scale = %i, slope = %i, bias = %i' % (154 n_flats, filter_id, self.scale, self.slope, self.bias))155 self._abort.clear()156 site = self._getSite()157 pos = site.sunpos()158 self.log.debug(159 'Starting sky flats Sun altitude is {}. max: {} min: {}'.format(pos.alt.D, self["sun_alt_hi"],160 self["sun_alt_low"]))161 self.log.debug('Starting dome track.')162 self._getDome().track()163 self.log.debug('Moving to filter {}.'.format(filter_id))164 if self["filterwheel"] is not None:165 fw = self._getFilterWheel()166 fw.setFilter(filter_id)167 # Wait with the telescope in the flat position.168 self._moveScope(tracking=False, pierSide=self['pier_side'])169 # while the Sun is above or below the flat field strip we just wait170 while pos.alt.D > self["sun_alt_hi"] or pos.alt.D < self["sun_alt_low"]:171 # Check if position is outside and return.172 # dusk173 if site.localtime().hour > 12 and pos.alt.D < self["sun_alt_low"]:174 self.log.debug('Finishing flats. Sun position below than {}'.format(self["sun_alt_low"]))175 return176 # dawn177 elif site.localtime().hour < 12 and pos.alt.D > self["sun_alt_hi"]:178 self.log.debug('Finishing flats. Sun position higher than {}'.format(self["sun_alt_low"]))179 return180 # checking for aborting signal181 if self._abort.isSet():182 self.log.warning('Aborting!')183 self._getTel().stopTracking()184 return185 time.sleep(5)186 pos = site.sunpos()187 self.log.debug('Sun altitude is %f waiting to be between %f and %f' % (188 pos.alt.D, self["sun_alt_hi"], self["sun_alt_low"]))189 pos = site.sunpos()190 # take flats until the Sun is out of the skyflats altitude or n_flats is reached191 i_flat = 0192 correction_factor = 0 #193 while self["sun_alt_hi"] > pos.alt.D > self["sun_alt_low"]:194 if i_flat == n_flats:195 self.log.debug('Done %i flats on filter %s' % (i_flat, filter_id))196 self._stopTracking()197 return198 self.log.debug("Initial positions {} {} {}".format(pos.alt.D, self["sun_alt_hi"], self["sun_alt_low"]))199 self._moveScope(tracking=self["tracking"]) # Go to the skyflat pos and shoot!200 aux = self.computeSkyFlatTime(correction_factor)201 if aux:202 expTime, sky_level_expected = aux203 else:204 self._stopTracking()205 return206 if expTime > 0:207 self.log.debug('Taking sky flat image with exptime = %f' % expTime)208 filename, image = self._takeImage(exptime=expTime, filter=filter_id, download=True, request=request)209 i_flat += 1210 sky_level = self.getSkyLevel(filename, image)211 self.exposeComplete(filter_id, i_flat, expTime, sky_level)212 correction_factor += sky_level / expTime - sky_level_expected / expTime213 self.log.debug('Done taking image, average counts = %f. '214 'New correction factor = %f' % (sky_level, correction_factor))215 else:216 # dusk217 if site.localtime().hour > 12:218 self.log.debug('Exposure time too low. Waiting 5 seconds.')219 time.sleep(5)220 # dawn221 else:222 self.log.debug('Exposure time too low. Finishing this filter...')223 self._stopTracking()224 return225 # checking for aborting signal226 if self._abort.isSet():227 self.log.warning('Aborting!')228 self._getTel().stopTracking()229 return230 pos = site.sunpos()231 self.log.debug("{} {} {}".format(pos.alt.D, self["sun_alt_hi"], self["sun_alt_low"]))232 def computeSkyFlatTime(self, correction_factor):233 """234 :param correction_factor: Additive correction factor for the sky counts exponential235 Method returns exposureTime236 This computation requires self.scale, self.slope and self.bias defined.237 """...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

...93 def start(self):94 self._startListening()95 self._startTracking()96 def stop(self):97 self._stopTracking()98 def setfolder(self):99 result = FileDialogs.request_old_directory("Open Directory:", default_dir = DirRef(self.folder.text))100 self.folder.text = "%s/%s" % (result.dir.path, result.name)101 def getProjectId(self, name):102 return filter(lambda e: e['name'] == name, self.projectData)[0]['_id']103 def _startTracking(self):104 project = RemoteProject(be, self.getProjectId(self.projects.value), self.host.text)105 project.deleteServerFrames(self._startTracking2)106 def _startTracking2(self, project):107 scene = SceneFolder(self.folder.text, self.extension.text)108 self.files = scene.collectAllFrameFiles()109 if len(self.files) > 0:110 project.uploadFrames(self.files, self.watchFolder)111 else:112 self.watchFolder(project, [])113 def _stopTracking(self):114 if self.observer:115 self.observer.stop()116 def _startListening(self):117 be.socket.on('progress', self._onProgress)118 be.socket.on('command', self._onCommand)119 be.socket.on('id', self._onId)120 be.socket.wait()121 def _onProgress(self):122 ""123 def _onCommand(self):124 ""125 def _onId(self, data):126 be.socketId = data127 be.socket.emit('openDocument', { 'id': self.getProjectId(self.projects.value), 'initials': '', 'userid': ''})...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

1from ._LoadRecognitionDB import *2from ._Recognition import *3from ._RecognitionRegister import *4from ._SaveRecognitionDB import *5from ._StartTracking import *6from ._StopTracking import *...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful