AstroToolkit 1.5.0__tar.gz → 1.5.1__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.
Files changed (56) hide show
  1. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/PKG-INFO +83 -3
  2. astrotoolkit-1.5.0/src/AstroToolkit.egg-info/PKG-INFO → astrotoolkit-1.5.1/README.md +80 -25
  3. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/pyproject.toml +3 -2
  4. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/dataquery.py +2 -2
  5. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/fetch_crts.py +2 -2
  6. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/imageoverlay.py +2 -1
  7. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/lightcurvequery.py +143 -12
  8. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Input/input_validation.py +1 -1
  9. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Misc/coordinate_conversions.py +5 -0
  10. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Plotting/plotmap.py +10 -3
  11. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Plotting/sedplotting.py +1 -3
  12. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Plotting/spectrumplotting.py +5 -4
  13. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Timeseries/lomb_scargle.py +24 -5
  14. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Tools.py +20 -12
  15. astrotoolkit-1.5.0/README.md → astrotoolkit-1.5.1/src/AstroToolkit.egg-info/PKG-INFO +105 -1
  16. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit.egg-info/SOURCES.txt +0 -1
  17. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit.egg-info/requires.txt +1 -0
  18. astrotoolkit-1.5.0/src/AstroToolkit/Configuration/baseconfig.py +0 -162
  19. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/LICENSE +0 -0
  20. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/MANIFEST.in +0 -0
  21. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/setup.cfg +0 -0
  22. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Config.py +0 -0
  23. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/hrdquery.py +0 -0
  24. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/imagequery.py +0 -0
  25. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/photquery.py +0 -0
  26. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/reddeningquery.py +0 -0
  27. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/rename_headers.py +0 -0
  28. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/sedquery.py +0 -0
  29. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/sigmaclip.py +0 -0
  30. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Data/spectrumquery.py +0 -0
  31. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/DatapageElements/datapage_buttons.py +0 -0
  32. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/DatapageElements/metadata_table.py +0 -0
  33. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Datapages.py +0 -0
  34. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Examples/datapage.py +0 -0
  35. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Examples/hrd.py +0 -0
  36. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Examples/image.py +0 -0
  37. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Examples/lightcurve.py +0 -0
  38. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Examples/localfiles.py +0 -0
  39. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Examples/sed.py +0 -0
  40. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Examples/spectrum.py +0 -0
  41. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Examples/timeseries.py +0 -0
  42. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/FileHandling/file_naming.py +0 -0
  43. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/FileHandling/file_reading.py +0 -0
  44. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/FileHandling/file_writing.py +0 -0
  45. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Misc/fitsfiles.py +0 -0
  46. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Misc/gridsetup.py +0 -0
  47. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Misc/identifier_generation.py +0 -0
  48. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Misc/pmcorrection.py +0 -0
  49. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Misc/search.py +0 -0
  50. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Plotting/backdrop_hrd_allmags.fits +0 -0
  51. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Plotting/hrdplotting.py +0 -0
  52. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Plotting/imageplotting.py +0 -0
  53. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Plotting/lightcurveplotting.py +0 -0
  54. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit/Timeseries/timeseries_formatting.py +0 -0
  55. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit.egg-info/dependency_links.txt +0 -0
  56. {astrotoolkit-1.5.0 → astrotoolkit-1.5.1}/src/AstroToolkit.egg-info/top_level.txt +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AstroToolkit
3
- Version: 1.5.0
3
+ Version: 1.5.1
4
4
  Summary: A package for the gathering and plotting of astronomical data.
5
5
  Author-email: Ethan Moorfield <ethan.moorfield@hotmail.co.uk>
6
6
  Project-URL: Homepage, https://github.com/WD-planets/AstroToolkit
7
7
  Project-URL: Issues, https://github.com/WD-planets/AstroToolkit/issues
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.8
10
+ Requires-Python: >=3.11
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
13
  Requires-Dist: astropy==6.0.1
@@ -21,6 +21,7 @@ Requires-Dist: pandas==2.2.2
21
21
  Requires-Dist: Requests==2.31.0
22
22
  Requires-Dist: beautifulsoup4==4.12.3
23
23
  Requires-Dist: scipy==1.13.0
24
+ Requires-Dist: selenium==4.21.0
24
25
 
25
26
  # AstroToolkit
26
27
 
@@ -49,6 +50,7 @@ AstroToolkit (ATK) is a set of tools for fetching, plotting, and analysing astro
49
50
  * [Spectrum Query](#spectrumquery)
50
51
  * [SED Query](#sedquery)
51
52
  * [HRD Query](#hrdquery)
53
+ * [Reddening Query](#reddeningquery)
52
54
  * [Proper Motion Correction](#correctpm)
53
55
  * [Local File Saving](#savedata)
54
56
  * [Local File Reading](#readdata)
@@ -499,10 +501,13 @@ Arguments:
499
501
  - 'powspec' - Lomb-Scargle power spectrum
500
502
  - 'phase' - phase folded light curve using Lomb-Scargle
501
503
 
502
- Additional Arguments (only valid light curve plots):
504
+ Additional Arguments:
505
+ For lightcurve plots:
503
506
  - colours: list = colour to plot each band that returned data. Defaults to black for all bands.
504
507
  - bands: list = bands to include. Includes all by default.
505
508
 
509
+ For phase fold plots:
510
+ - freq: float = frequency on which to fold the lightcurve data. If none is given, it will be folded on the peak Lomb-Scargle frequency.
506
511
  ```
507
512
 
508
513
  ```
@@ -855,6 +860,81 @@ save() - saves the plot created by the plot() method to local storage.
855
860
 
856
861
  <br>
857
862
 
863
+ #### 1.9. reddening query<a id="reddeningquery"></a>
864
+
865
+ **Additional Parameters:**
866
+
867
+ ```
868
+ survey: str = target survey
869
+ Can be one of:
870
+ - 'stilism'
871
+ - 'gdre'
872
+ ```
873
+
874
+ ```
875
+ !radius: int = search radius in arcseconds
876
+ ```
877
+
878
+ Additionally, requires one of:
879
+
880
+ ```
881
+ pos: list = [right ascension (deg), declination (deg)], target position
882
+ ```
883
+
884
+ ```
885
+ source: int = Gaia DR3 source_id.
886
+ Target Gaia DR3 source
887
+ ```
888
+
889
+ **Note:** For stilism queries, source input is required as a parallax is needed for distance calculations.
890
+
891
+ **Returns:**
892
+
893
+ ```
894
+ DataStruct: class = ATK Data Structure
895
+ ```
896
+
897
+ *Attributes:*
898
+
899
+ ```
900
+ kind: str = 'data'
901
+ ```
902
+
903
+ ```
904
+ subkind: str = kind of query (as listed above)
905
+ ```
906
+
907
+ ```
908
+ survey: str = target survey of query
909
+ ```
910
+
911
+ ```
912
+ catalogue: str = None
913
+ ```
914
+
915
+ ```
916
+ source: int = target Gaia DR3 source
917
+ ```
918
+
919
+ ```
920
+ pos: list = target position
921
+ ```
922
+
923
+ ```
924
+ identifier: str = positional identifier of target in format JHHMMSS.SS±DDMMSS.SS
925
+ ```
926
+
927
+ ```
928
+ data: dict = returned data, where:
929
+ keys: str = column headers
930
+ values : float = column values
931
+ ```
932
+
933
+ *Methods:*
934
+ None
935
+
936
+ <br>
937
+
858
938
  ### 2. correctpm<a id="correctpm"></a>
859
939
 
860
940
  Automatically corrects for proper motion between two surveys or two times for a given Gaia DR3 source *or* position if proper motion measurements also provided.
@@ -1,27 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: AstroToolkit
3
- Version: 1.5.0
4
- Summary: A package for the gathering and plotting of astronomical data.
5
- Author-email: Ethan Moorfield <ethan.moorfield@hotmail.co.uk>
6
- Project-URL: Homepage, https://github.com/WD-planets/AstroToolkit
7
- Project-URL: Issues, https://github.com/WD-planets/AstroToolkit/issues
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.8
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
- Requires-Dist: astropy==6.0.1
14
- Requires-Dist: astroquery==0.4.7
15
- Requires-Dist: bokeh==3.4.1
16
- Requires-Dist: cmasher==1.8.0
17
- Requires-Dist: matplotlib==3.8.4
18
- Requires-Dist: importlib_resources==6.4.0
19
- Requires-Dist: numpy==1.26.4
20
- Requires-Dist: pandas==2.2.2
21
- Requires-Dist: Requests==2.31.0
22
- Requires-Dist: beautifulsoup4==4.12.3
23
- Requires-Dist: scipy==1.13.0
24
-
25
1
  # AstroToolkit
26
2
 
27
3
  AstroToolkit (ATK) is a set of tools for fetching, plotting, and analysing astronomical data.
@@ -49,6 +25,7 @@ AstroToolkit (ATK) is a set of tools for fetching, plotting, and analysing astro
49
25
  * [Spectrum Query](#spectrumquery)
50
26
  * [SED Query](#sedquery)
51
27
  * [HRD Query](#hrdquery)
28
+ * [Reddening Query](#reddeningquery)
52
29
  * [Proper Motion Correction](#correctpm)
53
30
  * [Local File Saving](#savedata)
54
31
  * [Local File Reading](#readdata)
@@ -499,10 +476,13 @@ Arguments:
499
476
  - 'powspec' - Lomb-Scargle power spectrum
500
477
  - 'phase' - phase folded light curve using Lomb-Scargle
501
478
 
502
- Additional Arguments (only valid light curve plots):
479
+ Additional Arguments:
480
+ For lightcurve plots:
503
481
  - colours: list = colour to plot each band that returned data. Defaults to black for all bands.
504
482
  - bands: list = bands to include. Includes all by default.
505
483
 
484
+ For phase fold plots:
485
+ - freq: float = frequency on which to fold the lightcurve data. If none is given, it will be folded on the peak Lomb-Scargle frequency.
506
486
  ```
507
487
 
508
488
  ```
@@ -855,6 +835,81 @@ save() - saves the plot created by the plot() method to local storage.
855
835
 
856
836
  <br>
857
837
 
838
+ #### 1.9. reddening query<a id="reddeningquery"></a>
839
+
840
+ **Additional Parameters:**
841
+
842
+ ```
843
+ survey: str = target survey
844
+ Can be one of:
845
+ - 'stilism'
846
+ - 'gdre'
847
+ ```
848
+
849
+ ```
850
+ !radius: int = search radius in arcseconds
851
+ ```
852
+
853
+ Additionally, requires one of:
854
+
855
+ ```
856
+ pos: list = [right ascension (deg), declination (deg)], target position
857
+ ```
858
+
859
+ ```
860
+ source: int = Gaia DR3 source_id.
861
+ Target Gaia DR3 source
862
+ ```
863
+
864
+ **Note:** For stilism queries, source input is required as a parallax is needed for distance calculations.
865
+
866
+ **Returns:**
867
+
868
+ ```
869
+ DataStruct: class = ATK Data Structure
870
+ ```
871
+
872
+ *Attributes:*
873
+
874
+ ```
875
+ kind: str = 'data'
876
+ ```
877
+
878
+ ```
879
+ subkind: str = kind of query (as listed above)
880
+ ```
881
+
882
+ ```
883
+ survey: str = target survey of query
884
+ ```
885
+
886
+ ```
887
+ catalogue: str = None
888
+ ```
889
+
890
+ ```
891
+ source: int = target Gaia DR3 source
892
+ ```
893
+
894
+ ```
895
+ pos: list = target position
896
+ ```
897
+
898
+ ```
899
+ identifier: str = positional identifier of target in format JHHMMSS.SS±DDMMSS.SS
900
+ ```
901
+
902
+ ```
903
+ data: dict = returned data, where:
904
+ keys: str = column headers
905
+ values : float = column values
906
+ ```
907
+
908
+ *Methods:*
909
+ None
910
+
911
+ <br>
912
+
858
913
  ### 2. correctpm<a id="correctpm"></a>
859
914
 
860
915
  Automatically corrects for proper motion between two surveys or two times for a given Gaia DR3 source *or* position if proper motion measurements also provided.
@@ -7,13 +7,13 @@ include-package-data = true
7
7
 
8
8
  [project]
9
9
  name = "AstroToolkit"
10
- version = "1.5.0"
10
+ version = "1.5.1"
11
11
  authors = [
12
12
  { name="Ethan Moorfield", email="ethan.moorfield@hotmail.co.uk"},
13
13
  ]
14
14
  description = "A package for the gathering and plotting of astronomical data."
15
15
  readme = "README.md"
16
- requires-python = ">=3.8"
16
+ requires-python = ">=3.11"
17
17
  classifiers = [
18
18
  "Programming Language :: Python :: 3",
19
19
  "Operating System :: OS Independent",
@@ -30,6 +30,7 @@ dependencies = [
30
30
  "Requests==2.31.0",
31
31
  "beautifulsoup4==4.12.3",
32
32
  "scipy==1.13.0",
33
+ "selenium==4.21.0",
33
34
  ]
34
35
 
35
36
  [project.urls]
@@ -35,7 +35,7 @@ class SurveyInfo:
35
35
  "gaia": [2016, 0],
36
36
  "panstarrs": [2012, 0],
37
37
  "skymapper": [2016, 0],
38
- "galex": [2007, 0],
38
+ "galex": [2006, 8],
39
39
  "rosat": [1991, 0],
40
40
  "sdss": [2017, 0],
41
41
  "wise": [2010, 5],
@@ -278,7 +278,7 @@ class SurveyInfo:
278
278
  "overlay_type": "detection_mag",
279
279
  "ra_name": "ra",
280
280
  "dec_name": "dec",
281
- "colours": ["green", "blue", "red"],
281
+ "colours": ["limegreen", "blue", "red"],
282
282
  "default_overlay_mag": "phot_g_mean_mag",
283
283
  },
284
284
  "galex": {
@@ -11,7 +11,7 @@ from bs4 import BeautifulSoup as bs
11
11
  from importlib_resources import files
12
12
  from numpy import extract, genfromtxt
13
13
 
14
- TIMER = files("AstroToolkit.Settings").joinpath("CRTS_TIMER.txt")
14
+ TIMER = files("AstroToolkit.Configuration").joinpath("CRTS_TIMER.txt")
15
15
 
16
16
  if not os.path.isfile(str(TIMER)):
17
17
  with open(str(TIMER), "w") as timer:
@@ -23,7 +23,7 @@ if not os.path.isfile(str(TIMER)):
23
23
  def get_CRTS_lightcurve(pos, radius):
24
24
  ra, dec = pos[0], pos[1]
25
25
 
26
- survey_radius = int(radius/60)
26
+ survey_radius = int(radius / 60)
27
27
 
28
28
  with open(str(TIMER), "r") as timer:
29
29
  prev_query_time = timer.readline().split(":")
@@ -82,9 +82,10 @@ class OverlayData(object):
82
82
  self.returned_data["non_gaia"][f"{mag}_marker_size"].append(
83
83
  (
84
84
  half_image_size / 50
85
- + (half_image_size / 75) ** radius_multiplier
85
+ + (half_image_size / 75) ** (radius_multiplier * 1.15)
86
86
  )
87
87
  * base_marker_size
88
+ + 0.0005
88
89
  )
89
90
  else:
90
91
  self.returned_data["non_gaia"][f"{mag}_marker_size"].append(None)
@@ -12,10 +12,10 @@ class LightcurveStruct(object):
12
12
  def __str__(self):
13
13
  return "<ATK Lightcurve Structure>"
14
14
 
15
- def plot(self, kind="lightcurve", colours=None, bands=None):
15
+ def plot(self, kind="lightcurve", colours=None, bands=None, freq=None):
16
16
  from ..Plotting.plotmap import map_to_plot
17
17
 
18
- return map_to_plot(self, kind, colours, bands)
18
+ return map_to_plot(self, kind=kind, colours=colours, bands=bands, freq=freq)
19
19
 
20
20
  def sigmaclip(self, sigma=3):
21
21
  from .sigmaclip import sigma_clip
@@ -74,7 +74,7 @@ class ZtfQuery(GeneralQuery):
74
74
 
75
75
  data = pd.read_csv(BytesIO(response.content))
76
76
  if len(data) == 0:
77
- print("Note: {self.survey} query returned no data.")
77
+ print(f"Note: {self.survey} query returned no data.")
78
78
  return None
79
79
 
80
80
  return data
@@ -142,7 +142,9 @@ class AtlasQuery(GeneralQuery):
142
142
  headers = {"Authorization": f"Token {token}", "Accept": "application/json"}
143
143
  self.headers = headers
144
144
  else:
145
- print(f"Note: experiencing issues with {self.survey}.")
145
+ print(
146
+ f"Note: experiencing issues with {self.survey}. Please ensure that you have provided valid login credentials."
147
+ )
146
148
  return None
147
149
 
148
150
  do_correction = False
@@ -159,7 +161,7 @@ class AtlasQuery(GeneralQuery):
159
161
  data={
160
162
  "ra": self.pos[0],
161
163
  "dec": self.pos[1],
162
- "mjd_min": 60096.0,
164
+ "mjd_min": 50000.0,
163
165
  "propermotion_ra": self.pmra,
164
166
  "propermotion_dec": self.pmdec,
165
167
  "radec_epoch_year": 2000,
@@ -173,7 +175,7 @@ class AtlasQuery(GeneralQuery):
173
175
  data={
174
176
  "ra": self.pos[0],
175
177
  "dec": self.pos[1],
176
- "mjd_min": 60096.0,
178
+ "mjd_min": 50000.0,
177
179
  "radec_epoch_year": 2000,
178
180
  "use_reduced": True,
179
181
  },
@@ -198,7 +200,7 @@ class AtlasQuery(GeneralQuery):
198
200
  time.sleep(waittime)
199
201
  else:
200
202
  print(
201
- f"{self.survey} login failed. Please ensure that you have provided valid credentials."
203
+ f"{self.survey} login failed. Please ensure that you have provided valid login credentials."
202
204
  )
203
205
  return None
204
206
 
@@ -254,8 +256,6 @@ class AtlasQuery(GeneralQuery):
254
256
  data["duJy"].tolist(),
255
257
  )
256
258
 
257
- # chi > 100
258
- bad_indices_chi = set([i for i, element in enumerate(chi_arr) if element > 100])
259
259
  # abs(flux) < 3
260
260
  bad_indices_flux = set(
261
261
  [i for i, element in enumerate(flux) if abs(element) < 3]
@@ -273,14 +273,18 @@ class AtlasQuery(GeneralQuery):
273
273
  ]
274
274
  )
275
275
 
276
+ bad_indices_mag_hard_lim = set(
277
+ [i for i, element in enumerate(mag_err) if element > 0.5]
278
+ )
279
+
276
280
  bad_indices = list(
277
281
  set(
278
282
  itertools.chain(
279
283
  *[
280
- bad_indices_chi,
281
284
  bad_indices_flux,
282
285
  bad_indices_flux_err,
283
286
  bad_indices_mag,
287
+ bad_indices_mag_hard_lim,
284
288
  ]
285
289
  )
286
290
  )
@@ -294,6 +298,22 @@ class AtlasQuery(GeneralQuery):
294
298
  )
295
299
  obs_arr, mag, mag_err, mjd, mjd_ori, ra_arr, dec_arr = filtered_list
296
300
 
301
+ filtered_list = []
302
+ mask = [i for i, val in enumerate(mag) if val < 0]
303
+ for _, val in enumerate([obs_arr, mag, mag_err, mjd, mjd_ori, ra_arr, dec_arr]):
304
+ filtered_list.append(
305
+ [element for i, element in enumerate(val) if i not in mask]
306
+ )
307
+ obs_arr, mag, mag_err, mjd, mjd_ori, ra_arr, dec_arr = filtered_list
308
+
309
+ filtered_list = []
310
+ mask = [i for i, val in enumerate(mag_err) if val == 0]
311
+ for _, val in enumerate([obs_arr, mag, mag_err, mjd, mjd_ori, ra_arr, dec_arr]):
312
+ filtered_list.append(
313
+ [element for i, element in enumerate(val) if i not in mask]
314
+ )
315
+ obs_arr, mag, mag_err, mjd, mjd_ori, ra_arr, dec_arr = filtered_list
316
+
297
317
  # split data into bands
298
318
  data_split = []
299
319
  for band in ["o", "c", "i"]:
@@ -440,6 +460,116 @@ class GaiaQuery(GeneralQuery):
440
460
  return data_arr
441
461
 
442
462
 
463
+ class GaiaQuery(GeneralQuery):
464
+ def get_data(self, source=None, pos=None):
465
+ from ..Tools import query
466
+
467
+ data = query(
468
+ survey="gaia_lc",
469
+ kind="data",
470
+ pos=pos,
471
+ source=source,
472
+ radius=self.radius,
473
+ level="internal",
474
+ )
475
+ if data:
476
+ return data.data
477
+
478
+ def format_data(self, data):
479
+ import math
480
+
481
+ import numpy as np
482
+ from astropy.time import Time
483
+
484
+ # magnitude error formula taken from https://astronomy.stackexchange.com/questions/38371/how-can-i-calculate-the-uncertainties-in-magnitude-like-the-cds-does
485
+ bands = ["g", "bp", "rp"]
486
+ cols = []
487
+
488
+ data_arr = []
489
+ for band in bands:
490
+ if band == "g":
491
+ # time, flux, flux_err, mag
492
+ cols = [
493
+ "_tab8_5",
494
+ "_tab8_6",
495
+ "_tab8_7",
496
+ "_tab8_9",
497
+ "RA_ICRS",
498
+ "DE_ICRS",
499
+ ]
500
+ elif band == "bp":
501
+ # time, flux, flux_err, mag
502
+ cols = [
503
+ "_tab8_11",
504
+ "_tab8_12",
505
+ "_tab8_13",
506
+ "_tab8_15",
507
+ "RA_ICRS",
508
+ "DE_ICRS",
509
+ ]
510
+ elif band == "rp":
511
+ # time, flux, flux_err, mag
512
+ cols = [
513
+ "_tab8_16",
514
+ "_tab8_17",
515
+ "_tab8_18",
516
+ "_tab8_20",
517
+ "RA_ICRS",
518
+ "DE_ICRS",
519
+ ]
520
+
521
+ time, flux, flux_err, mag, ra, dec = (
522
+ data[cols[0]],
523
+ data[cols[1]],
524
+ data[cols[2]],
525
+ data[cols[3]],
526
+ data[cols[4]],
527
+ data[cols[5]],
528
+ )
529
+
530
+ mag_err = [(2.5 / np.log(10)) * (f_e / f) for f, f_e in zip(flux, flux_err)]
531
+
532
+ bad_indices = [i for i, val in enumerate(time) if math.isnan(val)]
533
+
534
+ # apply the above filter
535
+ filtered_list = []
536
+ for _, val in enumerate([mag, mag_err, time, ra, dec]):
537
+ filtered_list.append(
538
+ [element for i, element in enumerate(val) if i not in bad_indices]
539
+ )
540
+ mag, mag_err, time, ra, dec = filtered_list
541
+
542
+ mjd_ori = [Time(t + 2455197.5, format="jd").value for t in time]
543
+ mjd = [t - min(mjd_ori) for t in mjd_ori]
544
+
545
+ if len(mag) > 0:
546
+ data_arr.append(
547
+ {
548
+ "band": band,
549
+ "ra": ra,
550
+ "dec": dec,
551
+ "mjd": mjd,
552
+ "mjd_ori": mjd_ori,
553
+ "mag": mag,
554
+ "mag_err": mag_err,
555
+ }
556
+ )
557
+ else:
558
+ data_arr.append(
559
+ {
560
+ "band": band,
561
+ "ra": None,
562
+ "dec": None,
563
+ "mjd": None,
564
+ "mjd_ori": None,
565
+ "mag": None,
566
+ "mag_err": None,
567
+ }
568
+ )
569
+
570
+ return data_arr
571
+
572
+
443
573
  class AsassnQuery(GeneralQuery):
444
574
  def set_url(self):
445
575
  url = f"https://asas-sn.osu.edu/photometry.json?action=index&controller=photometry&dec={self.pos[1]}&epochs_max=&epochs_min=&ra={self.pos[0]}&radius={self.radius/60}&rms_max=&rms_min=&sort_by=raj2000&utf8=%E2%9C%93&vmag_max=&vmag_min="
@@ -452,7 +582,8 @@ class AsassnQuery(GeneralQuery):
452
582
  if data["count"] > 1:
453
583
  print(f"Note: {self.survey} query returned data for multiple objects")
454
584
  elif data["count"] == 0:
455
- print(f"Note: experiencing issues with {self.survey}")
585
+ print("Note: asassn query returned no data.")
586
+ return None
456
587
 
457
588
  return data
458
589
 
@@ -657,7 +788,7 @@ def query(survey, source, pos, radius, username=None, password=None):
657
788
  pmra, pmdec = None, None
658
789
  if source and survey != "atlas":
659
790
  from ..Tools import correctpm
660
-
791
+
661
792
  pos = correctpm(source=source, target_survey=survey)
662
793
  if not pos:
663
794
  return f_return
@@ -542,7 +542,7 @@ class ValidateReadfitsInput(InputObject):
542
542
  if val and val != "config":
543
543
  if key == "fname":
544
544
  self.input[key] = check_string(val)
545
- if key == "columns":
545
+ elif key == "columns":
546
546
  if isinstance(val, list):
547
547
  for i, col in enumerate(val):
548
548
  val[i] = check_string(col)
@@ -4,6 +4,11 @@ def conv_hms_to_deg(pos):
4
4
  elif "-" in pos:
5
5
  separator = "-"
6
6
 
7
+ pos = pos.replace(" ", "")
8
+ pos = pos.lower()
9
+ if pos.startswith("j"):
10
+ pos = pos.lstrip("j")
11
+
7
12
  ra, dec = pos.split(separator)[0], pos.split(separator)[1]
8
13
 
9
14
  h, m, s = float(ra[0:2]), float(ra[2:4]), float(ra[4:])
@@ -5,7 +5,13 @@ class Dimensions(object):
5
5
 
6
6
 
7
7
  def map_to_plot(
8
- struct, kind=None, colours=None, bands=None, spectrum_overlay=False, survey=None
8
+ struct,
9
+ kind=None,
10
+ colours=None,
11
+ bands=None,
12
+ spectrum_overlay=False,
13
+ survey=None,
14
+ freq=None,
9
15
  ):
10
16
  if not struct.data:
11
17
  print("Note: Plot() missing data, suggests that no data was returned")
@@ -24,12 +30,12 @@ def map_to_plot(
24
30
  elif kind == "powspec":
25
31
  from ..Timeseries.lomb_scargle import lomb_scargle
26
32
 
27
- plot = lomb_scargle(struct.data).powspec_plot
33
+ plot = lomb_scargle(struct.data, freq).powspec_plot
28
34
  dimensions = Dimensions(height=1, width=1)
29
35
  elif kind == "phase":
30
36
  from ..Timeseries.lomb_scargle import lomb_scargle
31
37
 
32
- plot = lomb_scargle(struct.data).phasefold_plot
38
+ plot = lomb_scargle(struct.data, freq).phasefold_plot
33
39
  dimensions = Dimensions(height=1, width=1)
34
40
  else:
35
41
  raise Exception("Invalid plotting kind for ATK Lightcurve data.")
@@ -69,6 +75,7 @@ def map_to_plot(
69
75
  config.read_config()
70
76
  plot.width = int(config.unit_size) * dimensions.width
71
77
  plot.height = int(config.unit_size) * dimensions.height
78
+ plot.output_backend = "svg"
72
79
 
73
80
  if hasattr(struct, "subkind"):
74
81
  suffix = struct.subkind
@@ -1,7 +1,7 @@
1
1
  import math
2
2
 
3
3
  from bokeh import events
4
- from bokeh.models import CustomJS, PrintfTickFormatter
4
+ from bokeh.models import CustomJS, NumeralTickFormatter, PrintfTickFormatter
5
5
  from bokeh.plotting import figure
6
6
 
7
7
 
@@ -88,8 +88,6 @@ def plot_sed(struct, spectrum_overlay, survey):
88
88
 
89
89
  legend_exists = True
90
90
 
91
- plot.xaxis.formatter = PrintfTickFormatter(format="%0e")
92
-
93
91
  if legend_exists:
94
92
  plot.legend.click_policy = "hide"
95
93
 
@@ -57,12 +57,14 @@ def get_overlay():
57
57
  def plot_spectrum(struct):
58
58
  x, y = struct.data["wavelength"], struct.data["flux"]
59
59
 
60
+ y = [i * pow(10, 16) for i in y]
61
+
60
62
  plot = figure(
61
63
  width=400,
62
64
  height=400,
63
65
  title=f"{struct.survey} Spectrum",
64
66
  x_axis_label=r"\[\lambda\text{ }[\text{AA}]\]",
65
- y_axis_label=r"\[\text{flux [erg}\text{ cm }^{-2}\text{ s }^{-1}\text{AA}^{-1}]\]",
67
+ y_axis_label=r"\[\text{flux [}10^{-16}\text{ erg}\text{ cm }^{-2}\text{ s }^{-1}\text{AA}^{-1}]\]",
66
68
  )
67
69
 
68
70
  plot.line(x, y, color="black", line_width=1)
@@ -90,6 +92,7 @@ def plot_spectrum(struct):
90
92
  y=[y_min, y_max],
91
93
  color=colours[index],
92
94
  legend_label=element["label"],
95
+ level="underlay",
93
96
  )
94
97
  if annotation:
95
98
  annotation_height = max(y) + (
@@ -100,7 +103,7 @@ def plot_spectrum(struct):
100
103
  y=annotation_height,
101
104
  x_offset=2,
102
105
  text=annotation,
103
- text_font_size="10pt",
106
+ text_font_size="12pt",
104
107
  )
105
108
 
106
109
  plot.add_layout(label)
@@ -111,8 +114,6 @@ def plot_spectrum(struct):
111
114
  CustomJS(args=dict(ls=label), code="ls.visible = cb_obj.visible;"),
112
115
  )
113
116
 
114
- plot.yaxis[0].formatter = PrintfTickFormatter(format="%0.1e")
115
-
116
117
  toggle_legend_js = CustomJS(
117
118
  args=dict(leg=plot.legend[0]),
118
119
  code="""
@@ -8,14 +8,15 @@ from bokeh.plotting import figure
8
8
  newline = "\n"
9
9
 
10
10
 
11
- def lomb_scargle(data):
11
+ def lomb_scargle(data, freq=None):
12
12
  class timeseries_data(object):
13
- def __init__(self, time, mag, mag_err, power, frequency):
13
+ def __init__(self, time, mag, mag_err, power, frequency, freq):
14
14
  self.time = time
15
15
  self.mag = mag
16
16
  self.mag_err = mag_err
17
17
  self.power = power
18
18
  self.frequency = frequency
19
+ self.phase_freq = freq
19
20
 
20
21
  @property
21
22
  def powspec_plot(self):
@@ -32,7 +33,7 @@ def lomb_scargle(data):
32
33
  plot.line(
33
34
  x=self.frequency,
34
35
  y=self.power,
35
- legend_label=f"Max Frequency: {round(max_freq.value,2)} 1/d {newline}Period: {round(period.value,2)}",
36
+ legend_label=f"Max Frequency: {round(max_freq.value,2)} 1/d {newline}Period: {round(period.value,2)} h",
36
37
  )
37
38
 
38
39
  toggle_legend_js = CustomJS(
@@ -48,11 +49,15 @@ def lomb_scargle(data):
48
49
  )
49
50
 
50
51
  plot.js_on_event(events.DoubleTap, toggle_legend_js)
52
+
51
53
  return plot
52
54
 
53
55
  @property
54
56
  def phasefold_plot(self):
55
- best_frequency = self.frequency[np.nanargmax(self.power)]
57
+ if not self.phase_freq:
58
+ best_frequency = self.frequency[np.nanargmax(self.power)]
59
+ else:
60
+ best_frequency = self.phase_freq / u.day
56
61
 
57
62
  t_fit = np.linspace(0, 1, 1000) * u.day
58
63
  ls = LombScargle(self.time, self.mag, self.mag_err)
@@ -108,6 +113,20 @@ def lomb_scargle(data):
108
113
 
109
114
  plot.y_range.flipped = True
110
115
 
116
+ toggle_legend_js = CustomJS(
117
+ args=dict(leg=plot.legend[0]),
118
+ code="""
119
+ if (leg.visible) {
120
+ leg.visible = false
121
+ }
122
+ else {
123
+ leg.visible = true
124
+ }
125
+ """,
126
+ )
127
+
128
+ plot.js_on_event(events.DoubleTap, toggle_legend_js)
129
+
111
130
  return plot
112
131
 
113
132
  if not data:
@@ -124,6 +143,6 @@ def lomb_scargle(data):
124
143
  freqs = np.linspace(0, 15, 150000) / u.day
125
144
  power = LombScargle(time, mag, mag_err, fit_mean=False).power(freqs)
126
145
 
127
- data_class = timeseries_data(time, mag, mag_err, power, freqs)
146
+ data_class = timeseries_data(time, mag, mag_err, power, freqs, freq)
128
147
 
129
148
  return data_class
@@ -2,18 +2,13 @@ from .Configuration.baseconfig import ConfigStruct
2
2
 
3
3
  """
4
4
  Changelog:
5
- - Rewritten toolkit in semi-object oriented structure, should help make future development much easier
6
- - All returned data is now returned in ATK objects rather than dicts, allows for methods such as the plot() method to be attached to the object itself.
7
- - All data queries now use Vizier. Increases completeness of eROSITA survey due to an unfixable bug with the URL querying method
8
- - Can now enter any Vizier survey ID in data queries, allows access to all data through Vizier.
9
- - Improved correctpm
10
- - can now correct between surveys supported by the toolkit, as well as any custom input/target times
11
- - can also automatically correct the coordinates of a Gaia source to any target time
12
- - added support for a new reddening query tool: https://irsa.ipac.caltech.edu/applications/DUST/
13
- - imaging overlays now support all bands from all supported surveys, and these can be chosen from
14
- - Removed aov timeseries tools, replaced with Lomb-Scargle periodogram/phase folding routines. Removes need for any 3rd party dependencies.
15
- - significant improvements to package configuration options
16
- - all ATK data structures now supported for local file saving/loading
5
+ - fixed bug with CRTS light curve queries
6
+ - Can now choose a frequency to plot in phase folded light curves
7
+ - fixed a bug in input checking that made readfits unusable
8
+ - fixed ATLAS light curve queries, extended MJD
9
+ - changed GALEX time from [2007,0] to [2006,8], seems to fit high PM object detections better.
10
+ - other bug fixes
11
+ - added reddening to README, forgot in last version
17
12
  """
18
13
 
19
14
  """
@@ -21,6 +16,15 @@ To-Do:
21
16
  - fix (especially tracer) query radius in overlays
22
17
  - update README
23
18
  - input validation for config values
19
+ - add "features" list to README
20
+ - add support for selecting a section of light curve to include in peridogram etc.
21
+ - add check for missing data in savedata
22
+ - currently, incorrect username/password in ATLAS just says experiencing issues
23
+ - allow user to choose a file name to save file as
24
+ - check atlas query + powspec
25
+ - add piggyback radius to config for image detection overlays
26
+ - add a config option for font size
27
+ - add a config option for svg/png output
24
28
  """
25
29
 
26
30
  config = ConfigStruct()
@@ -162,6 +166,7 @@ def query(
162
166
  source=source,
163
167
  overlays=overlays,
164
168
  )
169
+
165
170
  elif kind == "lightcurve":
166
171
  from .Data.lightcurvequery import query as lightcurve_query
167
172
 
@@ -173,6 +178,7 @@ def query(
173
178
  username=username,
174
179
  password=password,
175
180
  )
181
+
176
182
  elif kind == "phot":
177
183
  from .Data.photquery import query as phot_query
178
184
 
@@ -204,6 +210,8 @@ def query(
204
210
  if gaia_data.data:
205
211
  ra, dec = gaia_data.data["ra2000"][0], gaia_data.data["dec2000"][0]
206
212
  data.identifier = identifier_from_pos([ra, dec])
213
+ else:
214
+ data.identifier = identifier_from_pos(data.pos)
207
215
  elif hasattr(data, "sources") and data.data:
208
216
  identifiers = []
209
217
  for source in data.sources:
@@ -1,3 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: AstroToolkit
3
+ Version: 1.5.1
4
+ Summary: A package for the gathering and plotting of astronomical data.
5
+ Author-email: Ethan Moorfield <ethan.moorfield@hotmail.co.uk>
6
+ Project-URL: Homepage, https://github.com/WD-planets/AstroToolkit
7
+ Project-URL: Issues, https://github.com/WD-planets/AstroToolkit/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: astropy==6.0.1
14
+ Requires-Dist: astroquery==0.4.7
15
+ Requires-Dist: bokeh==3.4.1
16
+ Requires-Dist: cmasher==1.8.0
17
+ Requires-Dist: matplotlib==3.8.4
18
+ Requires-Dist: importlib_resources==6.4.0
19
+ Requires-Dist: numpy==1.26.4
20
+ Requires-Dist: pandas==2.2.2
21
+ Requires-Dist: Requests==2.31.0
22
+ Requires-Dist: beautifulsoup4==4.12.3
23
+ Requires-Dist: scipy==1.13.0
24
+ Requires-Dist: selenium==4.21.0
25
+
1
26
  # AstroToolkit
2
27
 
3
28
  AstroToolkit (ATK) is a set of tools for fetching, plotting, and analysing astronomical data.
@@ -25,6 +50,7 @@ AstroToolkit (ATK) is a set of tools for fetching, plotting, and analysing astro
25
50
  * [Spectrum Query](#spectrumquery)
26
51
  * [SED Query](#sedquery)
27
52
  * [HRD Query](#hrdquery)
53
+ * [Reddening Query](#reddeningquery)
28
54
  * [Proper Motion Correction](#correctpm)
29
55
  * [Local File Saving](#savedata)
30
56
  * [Local File Reading](#readdata)
@@ -475,10 +501,13 @@ Arguments:
475
501
  - 'powspec' - Lomb-Scargle power spectrum
476
502
  - 'phase' - phase folded light curve using Lomb-Scargle
477
503
 
478
- Additional Arguments (only valid light curve plots):
504
+ Additional Arguments:
505
+ For lightcurve plots:
479
506
  - colours: list = colour to plot each band that returned data. Defaults to black for all bands.
480
507
  - bands: list = bands to include. Includes all by default.
481
508
 
509
+ For phase fold plots:
510
+ - freq: float = frequency on which to fold the lightcurve data. If none is given, it will be folded on the peak Lomb-Scargle frequency.
482
511
  ```
483
512
 
484
513
  ```
@@ -831,6 +860,81 @@ save() - saves the plot created by the plot() method to local storage.
831
860
 
832
861
  <br>
833
862
 
863
+ #### 1.9. reddening query<a id="reddeningquery"></a>
864
+
865
+ **Additional Parameters:**
866
+
867
+ ```
868
+ survey: str = target survey
869
+ Can be one of:
870
+ - 'stilism'
871
+ - 'gdre'
872
+ ```
873
+
874
+ ```
875
+ !radius: int = search radius in arcseconds
876
+ ```
877
+
878
+ Additionally, requires one of:
879
+
880
+ ```
881
+ pos: list = [right ascension (deg), declination (deg)], target position
882
+ ```
883
+
884
+ ```
885
+ source: int = Gaia DR3 source_id.
886
+ Target Gaia DR3 source
887
+ ```
888
+
889
+ **Note:** For stilism queries, source input is required as a parallax is needed for distance calculations.
890
+
891
+ **Returns:**
892
+
893
+ ```
894
+ DataStruct: class = ATK Data Structure
895
+ ```
896
+
897
+ *Attributes:*
898
+
899
+ ```
900
+ kind: str = 'data'
901
+ ```
902
+
903
+ ```
904
+ subkind: str = kind of query (as listed above)
905
+ ```
906
+
907
+ ```
908
+ survey: str = target survey of query
909
+ ```
910
+
911
+ ```
912
+ catalogue: str = None
913
+ ```
914
+
915
+ ```
916
+ source: int = target Gaia DR3 source
917
+ ```
918
+
919
+ ```
920
+ pos: list = target position
921
+ ```
922
+
923
+ ```
924
+ identifier: str = positional identifier of target in format JHHMMSS.SS±DDMMSS.SS
925
+ ```
926
+
927
+ ```
928
+ data: dict = returned data, where:
929
+ keys: str = column headers
930
+ values : float = column values
931
+ ```
932
+
933
+ *Methods:*
934
+ None
935
+
936
+ <br>
937
+
834
938
  ### 2. correctpm<a id="correctpm"></a>
835
939
 
836
940
  Automatically corrects for proper motion between two surveys or two times for a given Gaia DR3 source *or* position if proper motion measurements also provided.
@@ -10,7 +10,6 @@ src/AstroToolkit.egg-info/SOURCES.txt
10
10
  src/AstroToolkit.egg-info/dependency_links.txt
11
11
  src/AstroToolkit.egg-info/requires.txt
12
12
  src/AstroToolkit.egg-info/top_level.txt
13
- src/AstroToolkit/Configuration/baseconfig.py
14
13
  src/AstroToolkit/Data/dataquery.py
15
14
  src/AstroToolkit/Data/fetch_crts.py
16
15
  src/AstroToolkit/Data/hrdquery.py
@@ -9,3 +9,4 @@ pandas==2.2.2
9
9
  Requests==2.31.0
10
10
  beautifulsoup4==4.12.3
11
11
  scipy==1.13.0
12
+ selenium==4.21.0
@@ -1,162 +0,0 @@
1
- import configparser
2
- import os
3
-
4
-
5
- class ConfigStruct(object):
6
- def __init__(self):
7
- from importlib_resources import files
8
-
9
- self.config_file = files("AstroToolkit.Configuration").joinpath("ATKConfig.ini")
10
- if not os.path.isfile(self.config_file):
11
- print("No ATKConfig.ini found. Making new one with default values\n")
12
- self.set_default_config()
13
- self.write_config()
14
-
15
- @property
16
- def supported_keys(self):
17
- keys = []
18
- for key, val in vars(self).items():
19
- if key != "config_file":
20
- keys.append(key)
21
- return keys
22
-
23
- def set_default_config(self):
24
- from ..Data.dataquery import SurveyInfo
25
-
26
- overlay_info = SurveyInfo().overlay_param_names
27
-
28
- self.enable_notifications = "True"
29
- self.query_data_radius = "3"
30
- self.query_phot_radius = "3"
31
- self.query_bulkphot_radius = "3"
32
- self.query_lightcurve_radius = "3"
33
- self.query_spectrum_radius = "3"
34
- self.query_sed_radius = "3"
35
- self.query_reddening_radius = "5"
36
- self.query_image_size = "30"
37
- self.query_image_overlays = "gaia"
38
- self.query_image_band = "g"
39
- self.query_lightcurve_atlas_username = "None"
40
- self.query_lightcurve_atlas_password = "None"
41
- self.unit_size = "400"
42
- self.search_radius = "3"
43
- self.datapage_search_button_radius = "3"
44
- self.gaia_overlay_mag = overlay_info["gaia"]["default_overlay_mag"]
45
- self.galex_overlay_mag = overlay_info["galex"]["default_overlay_mag"]
46
- self.wise_overlay_mag = overlay_info["wise"]["default_overlay_mag"]
47
- self.sdss_overlay_mag = overlay_info["sdss"]["default_overlay_mag"]
48
- self.twomass_overlay_mag = overlay_info["twomass"]["default_overlay_mag"]
49
- self.skymapper_overlay_mag = overlay_info["skymapper"]["default_overlay_mag"]
50
- self.panstarrs_overlay_mag = overlay_info["panstarrs"]["default_overlay_mag"]
51
- self.datapage_datatable_radius = "3"
52
- self.datapage_grid_size = "250"
53
-
54
- def read_config(self):
55
- Config = configparser.ConfigParser()
56
- Config.read(self.config_file)
57
-
58
- sections = []
59
- sections.append(Config["global_settings"])
60
- sections.append(Config["query_settings"])
61
- sections.append(Config["image_overlay_settings"])
62
- sections.append(Config["search_settings"])
63
- sections.append(Config["datapage_settings"])
64
-
65
- for section in sections:
66
- for key, val in section.items():
67
- setattr(self, key, val)
68
-
69
- def write_config(self):
70
- config = configparser.ConfigParser()
71
-
72
- config.add_section("global_settings")
73
- config.set("global_settings", "enable_notifications", self.enable_notifications)
74
- config.set("global_settings", "unit_size", self.unit_size)
75
-
76
- config.add_section("query_settings")
77
- config.set("query_settings", "query_data_radius", self.query_data_radius)
78
- config.set("query_settings", "query_phot_radius", self.query_phot_radius)
79
- config.set(
80
- "query_settings", "query_bulkphot_radius", self.query_bulkphot_radius
81
- )
82
- config.set(
83
- "query_settings", "query_lightcurve_radius", self.query_lightcurve_radius
84
- )
85
- config.set(
86
- "query_settings", "query_spectrum_radius", self.query_spectrum_radius
87
- )
88
- config.set("query_settings", "query_sed_radius", self.query_sed_radius)
89
- config.set(
90
- "query_settings", "query_reddening_radius", self.query_reddening_radius
91
- )
92
- config.set("query_settings", "query_image_size", self.query_image_size)
93
- config.set("query_settings", "query_image_overlays", self.query_image_overlays)
94
- config.set("query_settings", "query_image_band", self.query_image_band)
95
- config.set(
96
- "query_settings",
97
- "query_lightcurve_atlas_username",
98
- self.query_lightcurve_atlas_username,
99
- )
100
- config.set(
101
- "query_settings",
102
- "query_lightcurve_atlas_password",
103
- self.query_lightcurve_atlas_password,
104
- )
105
-
106
- config.add_section("image_overlay_settings")
107
- config.set("image_overlay_settings", "gaia_overlay_mag", self.gaia_overlay_mag)
108
- config.set(
109
- "image_overlay_settings", "galex_overlay_mag", self.galex_overlay_mag
110
- )
111
- config.set("image_overlay_settings", "wise_overlay_mag", self.wise_overlay_mag)
112
- config.set("image_overlay_settings", "sdss_overlay_mag", self.sdss_overlay_mag)
113
- config.set(
114
- "image_overlay_settings", "twomass_overlay_mag", self.twomass_overlay_mag
115
- )
116
- config.set(
117
- "image_overlay_settings",
118
- "skymapper_overlay_mag",
119
- self.skymapper_overlay_mag,
120
- )
121
- config.set(
122
- "image_overlay_settings",
123
- "panstarrs_overlay_mag",
124
- self.panstarrs_overlay_mag,
125
- )
126
-
127
- config.add_section("search_settings")
128
- config.set("search_settings", "search_radius", self.search_radius)
129
-
130
- config.add_section("datapage_settings")
131
- config.set(
132
- "datapage_settings",
133
- "datapage_search_button_radius",
134
- self.datapage_search_button_radius,
135
- )
136
- config.set(
137
- "datapage_settings",
138
- "datapage_datatable_radius",
139
- self.datapage_datatable_radius,
140
- )
141
- config.set("datapage_settings", "datapage_grid_size", self.datapage_grid_size)
142
-
143
- with open(self.config_file, "w") as file:
144
- config.write(file)
145
-
146
- def edit_config(self, key, value):
147
- self.read_config()
148
- if not isinstance(value, str):
149
- try:
150
- value = str(value)
151
- except:
152
- raise Exception("ATKConfig.ini options must be strings.")
153
- setattr(self, key, value)
154
- self.write_config()
155
-
156
- self.output_config()
157
-
158
- def output_config(self):
159
- self.read_config()
160
- for key, val in vars(self).items():
161
- if key != "config_file":
162
- print(f"{key} = {val}")
File without changes
File without changes
File without changes