Skip to content

Commit

Permalink
docs requirements update
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanLoh committed Jan 9, 2024
1 parent 4a459fd commit 7372af5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 26 deletions.
38 changes: 25 additions & 13 deletions bin/nenupy_src_vis
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ from nenupy.astro.astro_tools import hour_angle

PLOT_FRAME_WIDTH = 550
PLOT_FRAME_LENGTH = 800
INPUT_FRAME_WIDTH = 300
INPUT_FRAME_WIDTH = 310
ENTRY_WIDTH = 10
BUTTON_WIDTH = 5

TIME_STEPS = 100
FONTSIZE = 9
PAD = 20
FRAME_RELIEF = "flat"
FRAME_BORDER_WIDTH = 5

CMAP = "copper"#"RdYlGn"
CMAP = "copper" # "RdYlGn"
BACKGROUND_COLOR = "0.9"

ELEVATION_MIN = 1
Expand Down Expand Up @@ -103,7 +105,7 @@ def display_time_elevation(ax, time, elevation, color) -> None:
if time.size == 0: return

elevation_pad = 7
if elevation > 30:
if elevation > 40:
ytext = elevation - elevation_pad
ymax = elevation
ymin = ytext
Expand Down Expand Up @@ -149,7 +151,11 @@ def plot_source_visibility_linear(ax, source, sun) -> None:
hourFmt = mdates.DateFormatter("%H", usetex=True)
ax.xaxis.set_major_formatter(hourFmt)
#ax.autoscale_view()
ax.set_xlim(time_plt[0], time_plt[-1])
#ax.set_xlim(time_plt[0], time_plt[-1])
ax.set_xlim(
mdates.date2num((source.time[0] - TimeDelta(1800, format="sec")).datetime),
mdates.date2num((source.time[-1] + TimeDelta(1800, format="sec")).datetime),
)

# Mask the night time
if not (sun is None):
Expand Down Expand Up @@ -327,6 +333,7 @@ class BaseInputFrame(Frame, ABC):
justify="center"
)
self.date_entry.bind("<<DateEntrySelected>>", master.update)
self.date_entry.bind("<Return>", master.update)

coord_plot_button = Button(self, text="Go", command=self.plot_after_coord, width=BUTTON_WIDTH)
# name_plot_button = Button(self, text="Go", command=self.plot_after_name, width=BUTTON_WIDTH)
Expand Down Expand Up @@ -385,15 +392,15 @@ class LinearInputFrame(BaseInputFrame):
super().__init__(master=master, **kwargs)

self.el_1_val = DoubleVar(value=ELEVATION_MIN)
el_1_label = Label(self, text="First elevation threshold:", anchor="e")
el_1_label = Label(self, text="1st elevation threshold:", anchor="e")
el_1_entry = Entry(self, textvariable=self.el_1_val, width=ENTRY_WIDTH)

el_1_entry.bind("<Return>", self.update_elevation_min)
el_1_label.grid(column=0, row=4, pady=(PAD, 0), columnspan=2)
el_1_entry.grid(column=2, row=4, pady=(PAD, 0), columnspan=1)

self.el_2_val = DoubleVar(value=ELEVATION_MID)
el_2_label = Label(self, text="Second elevation threshold:", anchor="e")
el_2_label = Label(self, text="2nd elevation threshold:", anchor="e")
el_2_entry = Entry(self, textvariable=self.el_2_val, width=ENTRY_WIDTH)

el_2_entry.bind("<Return>", self.update_elevation_mid)
Expand Down Expand Up @@ -558,30 +565,35 @@ class VisibilityApp(Tk):
# # width=TOTAL_WIDTH - self.plot_frame["width"], height=TOTAL_HEIGHT/2)

# self.geometry(f"{TOTAL_WIDTH}x{TOTAL_HEIGHT}")

if plot_type.lower() == "linear":
self.plot_frame = LinearPlotFrame(self, borderwidth=5, relief="ridge",
self.plot_frame = LinearPlotFrame(self, borderwidth=FRAME_BORDER_WIDTH, relief=FRAME_RELIEF,
width=PLOT_FRAME_LENGTH,
height=PLOT_FRAME_WIDTH)
self.input_frame = LinearInputFrame(self, borderwidth=5, relief="ridge",
self.input_frame = LinearInputFrame(self, borderwidth=FRAME_BORDER_WIDTH, relief=FRAME_RELIEF,
width=INPUT_FRAME_WIDTH,
height=PLOT_FRAME_WIDTH)
self.geometry(f"{PLOT_FRAME_LENGTH + INPUT_FRAME_WIDTH}x{PLOT_FRAME_WIDTH}")
elif plot_type.lower() == "polar":
self.plot_frame = PolarPlotFrame(self, borderwidth=5, relief="ridge",
self.plot_frame = PolarPlotFrame(self, borderwidth=FRAME_BORDER_WIDTH, relief=FRAME_RELIEF,
width=PLOT_FRAME_LENGTH,
height=PLOT_FRAME_LENGTH)
self.input_frame = PolarInputFrame(self, borderwidth=5, relief="ridge",
self.input_frame = PolarInputFrame(self, borderwidth=FRAME_BORDER_WIDTH, relief=FRAME_RELIEF,
width=INPUT_FRAME_WIDTH,
height=PLOT_FRAME_LENGTH)
self.geometry(f"{PLOT_FRAME_LENGTH + INPUT_FRAME_WIDTH}x{PLOT_FRAME_LENGTH}")
else:
raise ValueError(f"Unrecognized plot_type '{plot_type}'!")

self.plot_frame.grid(column=0, row=0, rowspan=1)
# Allows the plot Frame to expand and shrink
self.rowconfigure(0, minsize=200, weight=1)
self.columnconfigure(0, minsize=200, weight=1)

self.plot_frame.grid(column=0, row=0, rowspan=1, sticky="news")
self.input_frame.grid(column=1, row=0)
# self.result_frame.grid(column=1, row=1)

self.eval('tk::PlaceWindow . center')
self.eval("tk::PlaceWindow . center")
self.title("nenupy - NenuFAR source visibility")

def update(self, *args) -> None:
Expand Down Expand Up @@ -619,7 +631,7 @@ class VisibilityApp(Tk):

# ============================================================= #
# -------------------- run_visibility_app --------------------- #
def run_visibility_app(plot_type: str = "rectilinear") -> None:
def run_visibility_app(plot_type: str = "linear") -> None:
app = VisibilityApp(plot_type=plot_type)
app.mainloop()

Expand Down
11 changes: 1 addition & 10 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,13 @@ Finally, observations can then be simulated using the simulated beam and a sky m

.. toctree::
:caption: Data reading
:maxdepth: 2
:maxdepth: 1

io/sst_reading
io/bst_reading
io/xst_reading
io/tf_reading

.. _data-analysis:

.. .. toctree::
.. :caption: Simulation
.. :maxdepth: 2
.. nenupy.beam
.. nenupy.skymodel
.. nenupy.simulation

.. _tools:

Expand Down
1 change: 1 addition & 0 deletions docs/nenupy.io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ nenupy.io
:undoc-members:
:show-inheritance:


4 changes: 3 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ dask
sqlalchemy
docutils
sphinx-rtd-theme
recommonmark
recommonmark
pytz
h5py
7 changes: 5 additions & 2 deletions nenupy/astro/astro_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@


from abc import ABC
from typing import Union, Tuple
from typing import Any, Union, Tuple
from enum import Enum, auto

import numpy as np
Expand Down Expand Up @@ -74,6 +74,9 @@ class SolarSystemSource(Enum):
SATURN = auto()
URANUS = auto()
NEPTUNE = auto()

def __contains__(self: type, member: object) -> bool:
return super().__contains__(member)
# ============================================================= #
# ============================================================= #

Expand Down Expand Up @@ -198,7 +201,7 @@ def local_sidereal_time(
# astropy computation accounting for precession and
# for nutation and using the latest available
# precession/nutation models
else:
else:
return time.sidereal_time(
kind="apparent",
longitude=observer.lon,
Expand Down

0 comments on commit 7372af5

Please sign in to comment.