Skip to content

Commit

Permalink
Merge pull request #17 from fact-project/fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
maxnoe authored Oct 30, 2019
2 parents f1399ac + 283f96a commit f016e4e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
42 changes: 21 additions & 21 deletions la_palma_overview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,28 +97,28 @@ def clock2img(rows, cols):


def smart_fact2img(rows, cols):
currents = sfc.sipm_currents()
drive_pointing = sfc.drive_pointing()
weather = sfc.weather()
rel_temp = sfc.camera_climate().relative_temperature_mean.value
currents = sfc.sipm_currents(fallback=True)
drive_pointing = sfc.drive_pointing(fallback=True)
weather = sfc.weather(fallback=True)
rel_temp = sfc.camera_climate(fallback=True).relative_temperature_mean.value
cam_temp = rel_temp + weather.temperature.value
humidity = weather.humidity.value

status_text = (
'SQM\n'
' Magnitude..{Magnitude: > 6.1f}\n'
'SIPM\n'
' min........{min_cur: > 6.1f} {cur_unit}\n'
' med........{med_cur: > 6.1f} {cur_unit}\n'
' max........{max_cur: > 6.1f} {cur_unit}\n'
' min........{min_cur:6.1f} {cur_unit}\n'
' med........{med_cur:6.1f} {cur_unit}\n'
' max........{max_cur:6.1f} {cur_unit}\n'
'Temp\n'
' outside....{out_temp: > 6.1f} C\n'
' container..{cont_temp: > 6.1f} C\n'
' camera.....{cam_temp: > 6.1f} C\n'
' outside....{out_temp:6.1f} °C\n'
' container..{cont_temp:6.1f} °C\n'
' camera.....{cam_temp:6.1f} °C\n'
'Weather\n'
' humidity...{humidity:6.0f} %\n'
'Pointing: {source_name}\n'
' Azimuth....{source_az: > 6.1f} {source_az_unit}\n'
' Zenith.....{source_zd: > 6.1f} {source_zd_unit}\n'
' Azimuth....{source_az:6.1f} {source_az_unit}\n'
' Zenith.....{source_zd:6.1f} {source_zd_unit}\n'
).format(
Magnitude=sfc.sqm().magnitude.value,
power=currents.power_camera.value,
power_unit=currents.power_camera.unit,
min_cur=currents.min_per_sipm.value,
Expand All @@ -128,6 +128,7 @@ def smart_fact2img(rows, cols):
out_temp=weather.temperature.value,
cont_temp=float(sfc.container_temperature().current.value),
cam_temp=cam_temp,
humidity=humidity,
source_name=sfc.current_source().name,
source_az=drive_pointing.azimuth.value,
source_zd=drive_pointing.zenith_distance.value,
Expand Down Expand Up @@ -169,7 +170,7 @@ def stack_image_list_into_rows_and_cols(imgs, big_rows, big_cols):
return col_stack


def download_and_resize_image(url, rows, cols, fmt='jpg', fallback=True):
def download_and_resize_image(url, rows, cols, fmt=None, fallback=True):
'''
Download image at url.
Resize to size cols x rows
Expand All @@ -178,7 +179,6 @@ def download_and_resize_image(url, rows, cols, fmt='jpg', fallback=True):
'''
try:
req = requests.get(url, verify=False, timeout=15)

img = skimage.io.imread(io.BytesIO(req.content), format=fmt)

if img.ndim == 2:
Expand Down Expand Up @@ -223,12 +223,12 @@ def save_image(output_path, overview_config=None):
'stacked_image': {'rows': 3, 'cols': 4},
'image_urls': [
'http://fact-project.org/cam/skycam.php',
'http://www.gtc.iac.es/multimedia/netcam/camaraAllSky.jpg',
'http://www.gtc.iac.es/multimedia/netcam/camaraAllSky',
'http://www.magic.iac.es/site/weather/AllSkyCurrentImage.JPG',
'http://www.magic.iac.es/site/weather/can.jpg',
'http://www.fact-project.org/cam/cam.php',
'http://www.fact-project.org/cam/lidcam.php',
'http://iris.not.iac.es/axis-cgi/jpg/image.cgi',
'http://www.not.iac.es/weather/img/domebig.jpg',
'http://www.gtc.iac.es/multimedia/netcam/camaraExt.jpg',
'http://www.magic.iac.es/site/weather/lastHUM6t.jpg',
'http://www.magic.iac.es/site/weather/lastWPK6t.jpg'
Expand All @@ -246,12 +246,12 @@ def save_image(output_path, overview_config=None):
'stacked_image': {'rows': 3, 'cols': 4},
'image_urls': [
'http://fact-project.org/cam/skycam.php',
'http://www.gtc.iac.es/multimedia/netcam/camaraAllSky.jpg',
'http://www.gtc.iac.es/multimedia/netcam/camaraAllSky',
'http://www.magic.iac.es/site/weather/AllSkyCurrentImage.JPG',
'http://www.magic.iac.es/site/weather/can.jpg',
'http://www.fact-project.org/cam/cam.php',
'http://www.fact-project.org/cam/lidcam.php',
'http://iris.not.iac.es/axis-cgi/jpg/image.cgi',
'http://www.not.iac.es/weather/img/domebig.jpg',
'http://www.tng.iac.es/webcam/get.html?resolution=640x480&compression=30&clock=1&date=1&dummy=1456393525188',
# 'http://www.gtc.iac.es/multimedia/netcam/camaraExt.jpg',
'http://www.magic.iac.es/site/weather/lastHUM6t.jpg',
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='la_palma_overview',
version='0.1.2',
version='0.1.3',
description=description,
url='https://github.com/fact-project/la_palma_overview.git',
author='Sebastian Mueller,Maximilian Noethe',
Expand All @@ -19,7 +19,7 @@
'docopt',
'scikit-image',
'requests',
'smart_fact_crawler==0.6.0',
'smart_fact_crawler~=0.6.4',
'send2trash',
'pillow',
],
Expand Down

0 comments on commit f016e4e

Please sign in to comment.