diff --git a/README.md b/README.md index c225d5c..ae980da 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ ax.legend() ### Handling Local Sidereal Time Using the `in_lst()` method of the output DataFrame, you can convert its time index to the local sidereal time (LST). -Here is a example script that shows JST on the bottom axis and LST on the top axis: +Here is an example that shows JST on the bottom axis and LST on the top axis: ```python import azely @@ -126,11 +126,11 @@ ax_jst.set_ylabel('Elevation (deg)') ax_jst.set_ylim(0, 90) ax_jst.grid(which='both') ax_jst.legend() +ax_jst.margins(0) # plot invisible elevation for the LST axis df.in_lst().el.plot(ax=ax_lst, alpha=0) ax_lst.xaxis.set_major_formatter(DateFormatter('%H:%M')) -ax_jst.margins(0) ax_lst.margins(0) ``` diff --git a/azely/api.py b/azely/api.py index 9e70382..6d26fcd 100644 --- a/azely/api.py +++ b/azely/api.py @@ -164,9 +164,9 @@ def calc( source = {"location": source, "object": source, "time": source} if isinstance(location, dict): - location_ = Location(**location) + location = Location(**location) elif isinstance(location, str): - location_ = get_location( + location = get_location( location, google_api=google_api, ipinfo_api=ipinfo_api, @@ -178,9 +178,9 @@ def calc( ) if isinstance(object, dict): - object_ = Object(**object) + object = Object(**object) elif isinstance(object, str): - object_ = get_object( + object = get_object( object, sep=sep, timeout=timeout, @@ -190,32 +190,32 @@ def calc( ) if isinstance(time, dict): - time_ = Time(**time) + time = Time(**time) elif isinstance(time, str): - time_ = get_time( + time = get_time( time, sep=sep, append=append.get("time", True), overwrite=overwrite.get("time", False), source=source.get("time", AZELY_CACHE), ) - time_ = replace(time_, timezone=str(location_.timezone)) + time = replace(time, timezone=str(location.timezone)) - skycoord = object_.skycoord( + skycoord = object.skycoord( ObsTime( - time_.index.tz_convert(None), - location=location_.earthlocation, + time.index.tz_convert(None), + location=location.earthlocation, ) ).altaz azel = AzEl( - index=time_.index, + index=time.index, data={ "az": skycoord.az, # type: ignore "el": skycoord.alt, # type: ignore }, ) - azel.location = location_ - azel.object = object_ - azel.time = time_ + azel.location = location + azel.object = object + azel.time = time return azel diff --git a/docs/_static/lst-axis.svg b/docs/_static/lst-axis.svg index 6b4c8a5..98efb6e 100644 --- a/docs/_static/lst-axis.svg +++ b/docs/_static/lst-axis.svg @@ -6,7 +6,7 @@ - 2025-07-06T16:03:59.086079 + 2025-07-07T01:13:33.683598 image/svg+xml @@ -42,16 +42,16 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -175,11 +175,11 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -187,16 +187,16 @@ L 853.2 68.884536 +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -248,11 +248,11 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -302,11 +302,11 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -356,11 +356,11 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -418,11 +418,11 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -467,11 +467,11 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -530,11 +530,11 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -734,16 +734,16 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -757,11 +757,11 @@ L -3.5 0 +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -776,11 +776,11 @@ L 853.2 194.507675 +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -816,11 +816,11 @@ z +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -835,11 +835,11 @@ L 853.2 122.723024 +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1103,7 +1103,7 @@ L 666.593077 271.017273 L 683.557343 281.3026 L 696.736997 289 L 696.736997 289 -" clip-path="url(#pabe7be221e)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square"/> - - + @@ -1326,7 +1326,7 @@ L 0 -3.5 - + @@ -1343,7 +1343,7 @@ L 0 -3.5 - + @@ -1360,7 +1360,7 @@ L 0 -3.5 - + @@ -1377,7 +1377,7 @@ L 0 -3.5 - + @@ -1394,7 +1394,7 @@ L 0 -3.5 - + @@ -1411,7 +1411,7 @@ L 0 -3.5 - + @@ -1428,7 +1428,7 @@ L 0 -3.5 - + @@ -1488,7 +1488,7 @@ z - + @@ -1501,7 +1501,7 @@ z - + @@ -1515,7 +1515,7 @@ z - + @@ -1529,7 +1529,7 @@ z - + @@ -1543,7 +1543,7 @@ z - + @@ -1613,7 +1613,7 @@ L 768.378671 177.647564 L 841.89049 224.852091 L 853.2 231.933125 L 853.2 231.933125 -" clip-path="url(#pabe7be221e)" style="fill: none; stroke: #1f77b4; stroke-opacity: 0; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#p474c8a8194)" style="fill: none; stroke: #1f77b4; stroke-opacity: 0; stroke-width: 1.5; stroke-linecap: square"/> + diff --git a/docs/_static/multiple-objects.svg b/docs/_static/multiple-objects.svg index fc13805..34ff57a 100644 --- a/docs/_static/multiple-objects.svg +++ b/docs/_static/multiple-objects.svg @@ -6,7 +6,7 @@ - 2025-07-06T16:03:58.932255 + 2025-07-07T01:13:29.479857 image/svg+xml @@ -42,16 +42,16 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -196,11 +196,11 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -208,16 +208,16 @@ L 853.2 26.88 +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -269,11 +269,11 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -323,11 +323,11 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -377,11 +377,11 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -425,11 +425,11 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -474,11 +474,11 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -537,11 +537,11 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -620,16 +620,16 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -643,11 +643,11 @@ L -3.5 0 +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -662,11 +662,11 @@ L 853.2 211.320889 +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -681,11 +681,11 @@ L 853.2 188.265778 +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -700,11 +700,11 @@ L 853.2 165.210667 +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -740,11 +740,11 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -759,11 +759,11 @@ L 853.2 119.100444 +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -778,11 +778,11 @@ L 853.2 96.045333 +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -809,11 +809,11 @@ z +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -828,11 +828,11 @@ L 853.2 49.935111 +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1169,7 +1169,7 @@ L 802.307203 235.921304 L 830.580979 262.270395 L 853.2 283.47752 L 853.2 283.47752 -" clip-path="url(#pfd5a95aaee)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #2ca02c; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #d62728; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#p3a36e2be4c)" style="fill: none; stroke: #9467bd; stroke-width: 1.5; stroke-linecap: square"/> + diff --git a/docs/_static/one-liner.svg b/docs/_static/one-liner.svg index d75654a..abf2c26 100644 --- a/docs/_static/one-liner.svg +++ b/docs/_static/one-liner.svg @@ -6,7 +6,7 @@ - 2025-07-06T16:03:58.631959 + 2025-07-07T01:13:21.067074 image/svg+xml @@ -42,16 +42,16 @@ z +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -175,23 +175,23 @@ z +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + - - + @@ -242,7 +242,7 @@ z - + @@ -291,7 +291,7 @@ z - + @@ -340,7 +340,7 @@ z - + @@ -397,7 +397,7 @@ z - + @@ -441,7 +441,7 @@ z - + @@ -499,7 +499,7 @@ z - + @@ -699,16 +699,16 @@ z +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -722,11 +722,11 @@ L -3.5 0 +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -741,11 +741,11 @@ L 853.2 209.974222 +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -760,11 +760,11 @@ L 853.2 185.572444 +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -779,11 +779,11 @@ L 853.2 161.170667 +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -819,11 +819,11 @@ z +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -838,11 +838,11 @@ L 853.2 112.367111 +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -857,11 +857,11 @@ L 853.2 87.965333 +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -876,11 +876,11 @@ L 853.2 63.563556 +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -895,11 +895,11 @@ L 853.2 39.161778 +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1167,7 +1167,7 @@ L 757.069161 282.692165 L 762.723916 285.848825 L 768.643919 289 L 768.643919 289 -" clip-path="url(#pcdf9ee6307)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#pc5f7825b95)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> + diff --git a/docs/plot.py b/docs/plot.py index 2b9a7d1..4cf2546 100644 --- a/docs/plot.py +++ b/docs/plot.py @@ -8,7 +8,7 @@ def plot_one_liner() -> None: """Plot an example of one-liner.""" fig, ax = plt.subplots(figsize=(12, 4)) - azely.calc("Sun", "Tokyo", "2025-07-07").el.plot( + azely.calc("Sun", "Tokyo", "2025-07-07", source=None).el.plot( ylabel="Elevation (deg)", ylim=(0, 90), grid=True, @@ -23,7 +23,7 @@ def plot_multiple_objects() -> None: fig, ax = plt.subplots(figsize=(12, 4)) for obj in ("Sun", "Sgr A*", "M87", "M104", "Cen A"): - df = azely.calc(obj, "ALMA AOS", "2017 April 11 UTC") + df = azely.calc(obj, "ALMA AOS", "2017 April 11 UTC", source=None) df.el.plot(ax=ax, label=df.object.name) ax.set_title(f"Location: {df.location.name}") @@ -42,7 +42,7 @@ def plot_lst_axis() -> None: ax_lst = ax_jst.twiny() for obj in ("M78", "M87"): - df = azely.calc(obj, "Tokyo", "2025-07-07") + df = azely.calc(obj, "Tokyo", "2025-07-07", source=None) df.el.plot(ax=ax_jst, label=df.object.name) ax_jst.set_title(f"Location: {df.location.name}") @@ -50,11 +50,11 @@ def plot_lst_axis() -> None: ax_jst.set_ylim(0, 90) ax_jst.grid(which="both") ax_jst.legend() + ax_jst.margins(0) # plot invisible elevation for the LST axis df.in_lst().el.plot(ax=ax_lst, alpha=0) ax_lst.xaxis.set_major_formatter(DateFormatter("%H:%M")) - ax_jst.margins(0) ax_lst.margins(0) fig.tight_layout()