diff --git a/setup.cfg b/setup.cfg index 447bcaa..8ebbf0f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = rgbmaker -version = 0.0.5.3 +version = 0.0.5.4 author = Avinash Kumar author_email = avialxee@gmail.com description = A python package which communicates to different astronomical services and fetches fits and numerical data. diff --git a/setup.py b/setup.py index 6de47b5..d662901 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name = 'rgbmaker', - version = '0.0.5.3', + version = '0.0.5.4', url='https://github.com/avialxee/rgbmaker', author='Avinash Kumar', author_email='avialxee@gmail.com', diff --git a/src/rgbmaker/__init__.py b/src/rgbmaker/__init__.py index 3eacd4e..a1a2c35 100644 --- a/src/rgbmaker/__init__.py +++ b/src/rgbmaker/__init__.py @@ -63,13 +63,16 @@ def submit_query(self): self.name, self.c, self.r = self._inp_sanitize() if self.c is not None : self._getNVAS(self.archives) + try: hdu_d_list, error = self.getdd(_input_svys, _input_sampler) + if error:self.otext.append(error) except: if self.c : if self.imagesopt == 1 or self.imagesopt == 2 or self.imagesopt == 3: - self.status, self.info = 'info', 'error fetching data from skyview' self.server_down=True + self.status, self.info = 'info', 'error fetching data from SkyView, contact developer' + else: self.status, self.info = 'info', 'No images to return' return self.throw_output() @@ -157,7 +160,7 @@ def getdd(self, input_svys, sampler): _imgls, _error = self._run_imgl( self.c, self.r, input_svys, sampler) for i in range(len(_imgls)): - if _imgls[i] == 0: + if _imgls[i] == 0 or len(_imgls[i])==0: _imglt.insert( i, [np.zeros((int(self.px), int(self.px))), None]) else: @@ -190,7 +193,7 @@ def _run_imgl(self, c, r, _in_svys, sam): returns a list of hdul and errors requested by getdd. """ result = [0]*len(_in_svys) - imglt, _error = [None]*2 + imglt, _error = None, {"survey_err":[],"exception":[]} _sam = sam try: #print(_in_svys) @@ -198,10 +201,11 @@ def _run_imgl(self, c, r, _in_svys, sam): for ind in range(len(_in_svys)): imglt = self._get_imgl_pool( [c, _in_svys[ind], r, result, ind, _sam[ind]]) - except: - _error = "problem with survey: " + str(_in_svys) + if len(imglt[ind])==0:_error["survey_err"].append(str(_in_svys[ind])) + except Exception as e: + _error["exception"].append(f"{str(e)}") except Exception as e: - _error = e + _error["exception"].append(f"{str(e)}") return imglt, _error def _get_imgl_pool(self, cals): @@ -218,7 +222,8 @@ def _get_imgl_pool(self, cals): queue[ind] = imglr except requests.exceptions.ConnectionError as e: self.server_down = True - self.info = e + self.status, self.info = 'warning', 'SkyView is down!' + except Exception as e: # --- if file not found/doesn't exist. Program will continue. print("{} not found ".format(svy)) diff --git a/src/rgbmaker/fetch.py b/src/rgbmaker/fetch.py index bb8ddba..0e84570 100644 --- a/src/rgbmaker/fetch.py +++ b/src/rgbmaker/fetch.py @@ -111,7 +111,6 @@ def query(name="", position="", radius=float(0.12), archives=1, level_contour=4 if fetch_q.server_down: - fetch_q.status, fetch_q.info = 'warning', 'SkyView is down!' return fetch_q.throw_output() else: