Kackle commited on
Commit
90bb313
·
verified ·
1 Parent(s): 8c5c24b

initial Azimuth Calc

Browse files
Files changed (1) hide show
  1. app.py +28 -5
app.py CHANGED
@@ -3,20 +3,43 @@ import datetime
3
  import requests
4
  import pytz
5
  import yaml
 
 
 
 
 
 
6
  from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
  """A tool that does nothing yet
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
 
 
18
  """
19
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -55,7 +78,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
3
  import requests
4
  import pytz
5
  import yaml
6
+ import openfoodfacts
7
+ import numpy as np
8
+ import matplotlib.pyplot as plt
9
+ from astropy import units as u
10
+ from astropy.coordinates import AltAz, EarthLocation, SkyCoord
11
+ from astropy.time import Time
12
  from tools.final_answer import FinalAnswerTool
13
 
14
  from Gradio_UI import GradioUI
15
 
16
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
17
  @tool
18
+ def calclateCelestrialAzimuth(_long:float, _lat:float, _celeasrealObj:str, observationTime:datetime)-> str: #it's import to specify the return type
19
  #Keep this format for the description / args / args description but feel free to modify the tool
20
  """A tool that does nothing yet
21
  Args:
22
+ lon: longitute of the observer
23
+ lat: latitude of observer
24
+ celeasrealObj: object the observer is trying to locate
25
+ observationTime: time of observation
26
  """
27
+ try:
28
+ # Define observer location
29
+ observer_location = EarthLocation(lat=_lat * u.deg, _long=-74 * u.deg, height=390 * u.m)
30
+
31
+ # Define observation time
32
+ time = celeasrealObj #Time("2025-06-06 23:00:00") - 4 * u.hour # Adjust for timezone
33
+
34
+ # Get celestial object coordinates (e.g., M33)
35
+ celeasrealObj = SkyCoord.from_name(_celeasrealObj)
36
+
37
+ # Convert to AltAz frame
38
+ obj_altaz = m33.transform_to(AltAz(obstime=time, location=observer_location))
39
+
40
+ print(f"Azimuth = {obj_altaz.az:.2f}, Altitude = {obj_altaz.alt:.2f}")
41
+
42
+ return f"Azimuth = {obj_altaz.az:.2f}, Altitude = {obj_altaz.alt:.2f}"
43
 
44
  @tool
45
  def get_current_time_in_timezone(timezone: str) -> str:
 
78
 
79
  agent = CodeAgent(
80
  model=model,
81
+ tools=[final_answer,get_current_time_in_timezone,calclateCelestrialAzimuth], ## add your tools here (don't remove final answer)
82
  max_steps=6,
83
  verbosity_level=1,
84
  grammar=None,