timewise 0.3.0rc6__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: timewise
3
- Version: 0.3.0rc6
3
+ Version: 0.3.2
4
4
  Summary: A small package to download infrared data from the WISE satellite
5
5
  Home-page: https://github.com/JannisNe/timewise
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "timewise"
3
- version = "0.3.0rc6"
3
+ version = "0.3.2"
4
4
  description = "A small package to download infrared data from the WISE satellite"
5
5
  authors = ["Jannis Necker <jannis.necker@gmail.com>"]
6
6
  license = "MIT"
@@ -470,21 +470,28 @@ class WISEDataDESYCluster(WiseDataByVisit):
470
470
  logger.debug(f"combining chunk {chunk}")
471
471
 
472
472
  try:
473
- self._combine_data_products('tap', chunk_number=chunk, remove=True, overwrite=self._overwrite)
474
-
475
- if self._storage_dir:
476
- filenames_to_move = [
477
- self._data_product_filename(service='tap', chunk_number=chunk),
478
- ]
479
-
480
- for t in self.photometry_table_keymap.keys():
481
- filenames_to_move.append(self._chunk_photometry_cache_filename(t, chunk))
482
-
483
- for fn in filenames_to_move:
484
- try:
485
- self._move_file_to_storage(fn)
486
- except shutil.SameFileError as e:
487
- logger.error(f"{e}. Not moving.")
473
+ success = self._combine_data_products('tap', chunk_number=chunk, remove=True, overwrite=self._overwrite)
474
+
475
+ if success:
476
+ if self._storage_dir:
477
+ filenames_to_move = [
478
+ self._data_product_filename(service='tap', chunk_number=chunk),
479
+ ]
480
+
481
+ for t in self.photometry_table_keymap.keys():
482
+ filenames_to_move.append(self._chunk_photometry_cache_filename(t, chunk))
483
+
484
+ for fn in filenames_to_move:
485
+ try:
486
+ self._move_file_to_storage(fn)
487
+ except shutil.SameFileError as e:
488
+ logger.error(f"{e}. Not moving.")
489
+
490
+ else:
491
+ msg = f"Chunk {chunk}: Combining data products not successfully!"
492
+ if self._storage_dir:
493
+ msg += " Not moving files to storage."
494
+ logger.warning(msg)
488
495
 
489
496
  finally:
490
497
  self._combining_queue.task_done()
@@ -678,7 +678,13 @@ class WISEDataBase(abc.ABC):
678
678
  with open(fn, "w") as f:
679
679
  json.dump(data_product, f, indent=4)
680
680
 
681
- def _combine_data_products(self, service=None, chunk_number=None, remove=False, overwrite=False):
681
+ def _combine_data_products(
682
+ self,
683
+ service=None,
684
+ chunk_number=None,
685
+ remove=False,
686
+ overwrite=False
687
+ ):
682
688
  if not service:
683
689
  logger.info("Combining all lightcuves collected with all services")
684
690
  itr = ['service', ['gator', 'tap']]
@@ -688,7 +694,7 @@ class WISEDataBase(abc.ABC):
688
694
  itr = ['chunk_number', range(self.n_chunks)]
689
695
  kwargs = {'service': service}
690
696
  elif chunk_number is not None:
691
- logger.info(f"Combining all lightcurves collected eith {service} for chunk {chunk_number}")
697
+ logger.info(f"Combining all lightcurves collected with {service} for chunk {chunk_number}")
692
698
  itr = ['jobID',
693
699
  list(self.clusterJob_chunk_map.index[self.clusterJob_chunk_map.chunk_number == chunk_number])]
694
700
  kwargs = {'service': service, 'chunk_number': chunk_number}
@@ -697,11 +703,13 @@ class WISEDataBase(abc.ABC):
697
703
 
698
704
  lcs = None
699
705
  fns = list()
706
+ missing_files = 0
700
707
  for i in itr[1]:
701
708
  kw = dict(kwargs)
702
709
  kw[itr[0]] = i
703
710
  kw['return_filename'] = True
704
711
  res = self.load_data_product(**kw)
712
+
705
713
  if not isinstance(res, type(None)):
706
714
  ilcs, ifn = res
707
715
  fns.append(ifn)
@@ -710,11 +718,28 @@ class WISEDataBase(abc.ABC):
710
718
  else:
711
719
  lcs.update(ilcs)
712
720
 
713
- self._save_data_product(lcs, service=service, chunk_number=chunk_number, overwrite=overwrite)
721
+ else:
722
+ missing_files += 1
723
+
724
+ if missing_files > 0:
725
+ msg = f"Missing {missing_files} for {service}"
726
+ if chunk_number is not None:
727
+ msg += f" chunk {chunk_number}"
728
+ msg += "! Not saving data product"
729
+ logger.warning(msg)
730
+ break
731
+
732
+ if missing_files == 0:
733
+ self._save_data_product(lcs, service=service, chunk_number=chunk_number, overwrite=overwrite)
714
734
 
715
- if remove:
716
- for fn in tqdm.tqdm(fns, desc="removing files"):
717
- os.remove(fn)
735
+ if remove:
736
+ for fn in tqdm.tqdm(fns, desc="removing files"):
737
+ os.remove(fn)
738
+
739
+ return True
740
+
741
+ else:
742
+ return False
718
743
 
719
744
  # ----------------------------------------------------------------------------------- #
720
745
  # START using GATOR to get photometry #
@@ -327,12 +327,19 @@ class WiseDataByVisit(WISEDataBase):
327
327
  metadata[Nk] = len(ilc)
328
328
 
329
329
  if len(ilc) > 0:
330
- metadata[mean_weighted_ppb_key] = np.average(ilc[llumkey], weights=ilc[ppb_key])
331
- metadata[excess_variance_key], metadata[excess_variance_err_key] = get_excess_variance(
332
- np.array(ilc[llumkey]),
333
- np.array(ilc[errkey]),
334
- np.array(metadata[mean_weighted_ppb_key])
335
- )
330
+ # check if ppb sum to more than zero
331
+ if sum(ilc[ppb_key]) > 0:
332
+ metadata[mean_weighted_ppb_key] = np.average(ilc[llumkey], weights=ilc[ppb_key])
333
+ metadata[excess_variance_key], metadata[excess_variance_err_key] = get_excess_variance(
334
+ np.array(ilc[llumkey]),
335
+ np.array(ilc[errkey]),
336
+ np.array(metadata[mean_weighted_ppb_key])
337
+ )
338
+
339
+ # if not we can not calculate the excess variance
340
+ else:
341
+ for k in [mean_weighted_ppb_key, excess_variance_key, excess_variance_err_key]:
342
+ metadata[k] = np.nan
336
343
 
337
344
  imin = ilc[llumkey].min()
338
345
  imax = ilc[llumkey].max()
@@ -1,43 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- packages = \
5
- ['timewise']
6
-
7
- package_data = \
8
- {'': ['*']}
9
-
10
- install_requires = \
11
- ['astropy>=5.1,<6.0',
12
- 'backoff>=2.1.2,<3.0.0',
13
- 'coveralls>=3.3.1,<4.0.0',
14
- 'furo>=2022.6.21,<2023.0.0',
15
- 'matplotlib>=3.5.3,<4.0.0',
16
- 'myst-parser>=0.18.0,<0.19.0',
17
- 'numpy>=1.23.2,<2.0.0',
18
- 'pandas>=1.4.3,<2.0.0',
19
- 'pyvo>=1.3,<2.0',
20
- 'requests>=2.28.1,<3.0.0',
21
- 'scikit-image>=0.19.3,<0.20.0',
22
- 'seaborn>=0.11.2,<0.13.0',
23
- 'tqdm>=4.64.0,<5.0.0',
24
- 'virtualenv>=20.16.3,<21.0.0']
25
-
26
- setup_kwargs = {
27
- 'name': 'timewise',
28
- 'version': '0.3.0rc6',
29
- 'description': 'A small package to download infrared data from the WISE satellite',
30
- 'long_description': "[![CI](https://github.com/JannisNe/timewise/actions/workflows/continous_integration.yml/badge.svg)](https://github.com/JannisNe/timewise/actions/workflows/continous_integration.yml)\n[![Coverage Status](https://coveralls.io/repos/github/JannisNe/timewise/badge.svg?branch=main)](https://coveralls.io/github/JannisNe/timewise?branch=main)\n[![PyPI version](https://badge.fury.io/py/timewise.svg)](https://badge.fury.io/py/timewise)\n[![Documentation Status](https://readthedocs.org/projects/timewise/badge/?version=latest)](https://timewise.readthedocs.io/en/latest/?badge=latest)\n[![DOI](https://zenodo.org/badge/449677569.svg)](https://zenodo.org/badge/latestdoi/449677569)\n\n\n\n# `timewise` is great, love it!\nDownload infrared lightcurves recorded with the WISE satellite.\n\n## Installation\n\n`timewise` is a python package, installable through `pip`\n```\npip install timewise\n```\n\nIf you would like to contribute just clone the repository. Easy.\n\n\n## Dependencies\n\nAll dependencies are listed in `requirements.txt`. If installing with `pip` they will automatically installed.\nOtherwise you can install them with `pip install -r requirements.txt`.\n\nThere is one package that does not obey! It's `SciServer`! \nIt's used to access SDSS data and plot cutouts. If you want to use this functionality \ninstall [this](https://github.com/sciserver/SciScript-Python) and create an account [here](https://www.sciserver.org).\nAs soon as required you will be required to enter your username and password.\n\n\n## Testing\n You can verify that everything is working (because this package is flawless and works everywhere.) by executing\n the unittest\n```\npython -m unittest discover tests/\n```\n\n## Cite\nIf you you `timewise` please cite [this](https://zenodo.org/badge/latestdoi/449677569).\n\n## Usage\nDetailed documentation can be found [here](https://timewise.readthedocs.io/en/latest/)\n",
31
- 'author': 'Jannis Necker',
32
- 'author_email': 'jannis.necker@gmail.com',
33
- 'maintainer': 'None',
34
- 'maintainer_email': 'None',
35
- 'url': 'https://github.com/JannisNe/timewise',
36
- 'packages': packages,
37
- 'package_data': package_data,
38
- 'install_requires': install_requires,
39
- 'python_requires': '>=3.8,<3.12',
40
- }
41
-
42
-
43
- setup(**setup_kwargs)
File without changes
File without changes
File without changes