Как установить пакет Astropy Python на iOS?Python

Программы на Python
Ответить
Anonymous
 Как установить пакет Astropy Python на iOS?

Сообщение Anonymous »

Я пытаюсь запустить на своем iPhone и iPad сценарий Python, использующий пакет Astropy. Я установил и Pythonista, и Juno. Предполагается, что Juno установил его, но я получаю ошибки. Сценарий, который я пытаюсь запустить, довольно прост и приведен ниже. Он работает на настольном компьютере, поэтому ошибок в нем нет.
import astropy.units as u
from astropy.coordinates import EarthLocation, SkyCoord, AltAz
from astropy.time import Time
import requests

def get_equatorial_coords():
# 1. Define the Observer's Location: Roseville, California
# Lat/Lon for Roseville, CA
# location = EarthLocation(lat=38.7521*u.deg, lon=-121.2859*u.deg, height=50*u.m)
try:
# Use ip-api.com (free, no API key required for low volume)
response = requests.get("http://ip-api.com/json/")
data = response.json()

if data['status'] == 'success':
lat = data['lat']
lon = data['lon']
city = data['city']
region = data['regionName']

# Create the Astropy EarthLocation object
# Note: height is set to 0 as IP geo usually doesn't provide altitude
location = EarthLocation(lat=lat * u.deg, lon=lon * u.deg, height=0 * u.m)
finally:
print(f"Detected Location: {city}, {region}")
print(f"Coordinates: {lat}, {lon}")

# location = get_location_by_ip()
# 2. Get the current system time (UTC)
current_time = Time.now()

print(f"--- Observation Details ---")
print(f"Location: Roseville, CA")
print(f"System Time (UTC): {current_time}")
print("-" * 27)

# 3. Request Target Input from User
try:

user_az = float(input("Enter azimuth 0.0 to 180.0: "))
user_alt = float(input("Enter altitude 0.0 to 90.0: "))
except ValueError:
print("Invalid input. Please enter numerical values.")
return

# 4. Create an AltAz frame for the specific time and location
altaz_frame = AltAz(obstime=current_time, location=location)

# 5. Define the target in the AltAz system
target_altaz = SkyCoord(az=user_az*u.deg, alt=user_alt*u.deg, frame=altaz_frame)

# 6. Transform to Equatorial Coordinates (ICRS/J2000)
target_icrs = target_altaz.transform_to('icrs')

print(f"\n--- Results ---")
print(f"Right Ascension (RA): {target_icrs.ra.to_string(unit=u.hour, sep='hms')}")
print(f"Declination (Dec): {target_icrs.dec.to_string(unit=u.deg, sep='dms')}")

if __name__ == "__main__":
get_equatorial_coords()


Подробнее здесь: https://stackoverflow.com/questions/798 ... age-on-ios
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»