orbitsift 0.1.0__py3-none-any.whl

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.
Files changed (56) hide show
  1. orbitsift/__init__.py +2 -0
  2. orbitsift/_native.py +13 -0
  3. orbitsift/ades.py +166 -0
  4. orbitsift/archives/__init__.py +244 -0
  5. orbitsift/archives/cadc.py +97 -0
  6. orbitsift/archives/decam_geom.json +1 -0
  7. orbitsift/archives/eso.py +213 -0
  8. orbitsift/archives/hsc_geom.json +2378 -0
  9. orbitsift/archives/ing.py +70 -0
  10. orbitsift/archives/listing.py +22 -0
  11. orbitsift/archives/noirlab.py +302 -0
  12. orbitsift/archives/ps1.py +59 -0
  13. orbitsift/archives/sdss.py +52 -0
  14. orbitsift/archives/smoka.py +369 -0
  15. orbitsift/blind.py +558 -0
  16. orbitsift/catalog.py +328 -0
  17. orbitsift/cli.py +2200 -0
  18. orbitsift/config.py +85 -0
  19. orbitsift/confirm.py +1030 -0
  20. orbitsift/data/nsc_dr2_k4m_ksb.csv.gz +0 -0
  21. orbitsift/dense.py +788 -0
  22. orbitsift/dynamics.py +235 -0
  23. orbitsift/expindex.py +456 -0
  24. orbitsift/extend.py +690 -0
  25. orbitsift/external.py +204 -0
  26. orbitsift/extract.py +148 -0
  27. orbitsift/growth.py +224 -0
  28. orbitsift/images.py +676 -0
  29. orbitsift/itf.py +154 -0
  30. orbitsift/known.py +716 -0
  31. orbitsift/link.py +509 -0
  32. orbitsift/lov.py +642 -0
  33. orbitsift/mcp_server.py +164 -0
  34. orbitsift/multiyear.py +409 -0
  35. orbitsift/net.py +265 -0
  36. orbitsift/orbit.py +614 -0
  37. orbitsift/plugins.py +97 -0
  38. orbitsift/precovery.py +187 -0
  39. orbitsift/presets/a2.json +85 -0
  40. orbitsift/presets/confirm_v1.json +190 -0
  41. orbitsift/presets/confirm_v2.json +236 -0
  42. orbitsift/presets/lostrec.json +74 -0
  43. orbitsift/recover.py +377 -0
  44. orbitsift/rubin.py +328 -0
  45. orbitsift/survey.py +268 -0
  46. orbitsift/tiles.py +58 -0
  47. orbitsift/unused.py +103 -0
  48. orbitsift/vet.py +304 -0
  49. orbitsift/workflow/__init__.py +5 -0
  50. orbitsift/workflow/models.py +103 -0
  51. orbitsift/workflow/sqlite.py +189 -0
  52. orbitsift-0.1.0.dist-info/METADATA +443 -0
  53. orbitsift-0.1.0.dist-info/RECORD +56 -0
  54. orbitsift-0.1.0.dist-info/WHEEL +4 -0
  55. orbitsift-0.1.0.dist-info/entry_points.txt +3 -0
  56. orbitsift-0.1.0.dist-info/licenses/LICENSE +28 -0
orbitsift/config.py ADDED
@@ -0,0 +1,85 @@
1
+ """Settings: built-in defaults, overridden by a TOML file, overridden by command-line flags.
2
+
3
+ The TOML file has the same layout as ``DEFAULTS`` (see docs/config.md). Sections ``link``, ``vet``,
4
+ ``orbit``, ``precovery`` and ``forced`` are passed as keyword arguments to the functions of the same
5
+ name, so every key there is a parameter name of that function.
6
+ """
7
+ import copy
8
+ import os
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ try:
13
+ import tomllib
14
+ except ModuleNotFoundError: # Python 3.10
15
+ import tomli as tomllib
16
+
17
+ DEFAULTS = {
18
+ "cache_dir": "", # empty: platform cache directory (see cache_dir())
19
+ "site": "W84", # MPC observatory code of the images (W84 = DECam on the CTIO Blanco 4 m)
20
+ "net": {"min_interval_s": 1.0, "max_concurrent": 2, "retries": 5, "timeout_s": 600, "deadline_s": 1800,
21
+ "contact": "", # User-Agent contact ('Name; email'); empty: ORBITSIFT_CONTACT, else ~/.orbitsift_contact
22
+ "log": "", # request log file; empty: <cache>/requests.log; "off": none
23
+ "strict": False, # send only requests on net.STRICT_ALLOW + allow
24
+ "allow": []}, # extra allowlist patterns (regular expressions) for strict mode
25
+ "catalog": {"tap_url": "https://datalab.noirlab.edu/tap/sync"},
26
+ "link": {"dist_min": 30.0, "dist_max": 150.0, "dtmax": 40.0, "nmin": 4, "sig": 0.2, "dmag": 1.0},
27
+ "vet": {"min_found_frac": 0.7, "cr_fwhm_ratio": 0.8, "cr_min_flagged": 2, "trail_min": 5, "static_radius": 1.0,
28
+ "kepler_rms_max": 0.2, "ident_backend": "jpl",
29
+ "ident_two_pass": True},
30
+ "orbit": {"sigma": 0.15, "r_min": 15.0, "r_max": 200.0,
31
+ "findorb_min_seasons": 2}, # fit --backend auto: Find_Orb from this many seasons (gaps > 120 d)
32
+ "precovery": {"min_p": 0.02, "radius": 5.0, "link_radius": 4.0, "rms_max": 0.2},
33
+ "forced": {"max_ext": 13.0, "start": "2012-09-01", "end": "", "min_snr": 5.0},
34
+ "confirm": {"preset": "confirm_v2", "exposures": [], "registry": [], "ccd_cache": "", "streams": 1,
35
+ "twins": 4, "bulk_ccds": 500, "backend": "internal", "rule": {}},
36
+ "ades": {"submitter": "", "email": "", "measurers": [], "observers": [], "trksub_prefix": "OS",
37
+ "design": "Reflector", "aperture": 4.0, "detector": "CCD", "comment": []},
38
+ }
39
+
40
+ _cache_override = None
41
+
42
+
43
+ def load(path=None):
44
+ """Defaults merged with a TOML file: ``path``, else ``./orbitsift.toml`` if present."""
45
+ cfg = copy.deepcopy(DEFAULTS)
46
+ if path is None and Path("orbitsift.toml").exists():
47
+ path = "orbitsift.toml"
48
+ if path:
49
+ with open(path, "rb") as f:
50
+ user = tomllib.load(f)
51
+ for k, v in user.items():
52
+ if k not in cfg:
53
+ raise ValueError(f"{path}: unknown setting '{k}'")
54
+ if isinstance(v, dict):
55
+ unknown = set(v) - set(cfg[k])
56
+ if unknown:
57
+ raise ValueError(f"{path}: unknown key(s) in [{k}]: {', '.join(sorted(unknown))}")
58
+ cfg[k].update(v)
59
+ else:
60
+ cfg[k] = v
61
+ return cfg
62
+
63
+
64
+ def apply(cfg):
65
+ """Push network and cache settings into the modules that use them."""
66
+ global _cache_override
67
+ from . import catalog, net
68
+ net.settings.update(cfg["net"])
69
+ catalog.TAP_URL = cfg["catalog"]["tap_url"]
70
+ _cache_override = cfg["cache_dir"] or None
71
+
72
+
73
+ def cache_dir():
74
+ """Cache directory: --cache-dir / config, else $ORBITSIFT_CACHE, else the platform user cache dir."""
75
+ d = _cache_override or os.environ.get("ORBITSIFT_CACHE")
76
+ if not d:
77
+ if sys.platform == "darwin":
78
+ d = Path.home() / "Library" / "Caches" / "orbitsift"
79
+ elif os.name == "nt":
80
+ d = Path(os.environ.get("LOCALAPPDATA", Path.home())) / "orbitsift" / "Cache"
81
+ else:
82
+ d = Path(os.environ.get("XDG_CACHE_HOME", Path.home() / ".cache")) / "orbitsift"
83
+ d = Path(d).expanduser()
84
+ d.mkdir(parents=True, exist_ok=True)
85
+ return d