@@ -561,7 +561,7 class ABSConfiguration(Configuration): | |||||
561 | # Create the datagram socket |
|
561 | # Create the datagram socket | |
562 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
|
562 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
563 | sock.settimeout(1) |
|
563 | sock.settimeout(1) | |
564 |
local_ip = os.environ.get('LOCAL_IP', '192.168. |
|
564 | local_ip = os.environ.get('LOCAL_IP', '192.168.1.128') | |
565 | sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(local_ip)) |
|
565 | sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(local_ip)) | |
566 | sock.sendto(message.encode(), multicast_group) |
|
566 | sock.sendto(message.encode(), multicast_group) | |
567 | print('Sending ' + message) |
|
567 | print('Sending ' + message) |
@@ -11,7 +11,7 urlpatterns = ( | |||||
11 | path('<int:id_conf>/change_beam/<int:id_beam>/', views.send_beam, name='url_send_beam'), |
|
11 | path('<int:id_conf>/change_beam/<int:id_beam>/', views.send_beam, name='url_send_beam'), | |
12 | path('<int:id_conf>/plot/', views.plot_patterns, name='url_plot_abs_patterns'), |
|
12 | path('<int:id_conf>/plot/', views.plot_patterns, name='url_plot_abs_patterns'), | |
13 | path('<int:id_conf>/plot/<int:id_beam>/', views.plot_patterns, name='url_plot_abs_patterns'), |
|
13 | path('<int:id_conf>/plot/<int:id_beam>/', views.plot_patterns, name='url_plot_abs_patterns'), | |
14 |
path('<int:id_conf>/plot/<int:id_beam>/< |
|
14 | path('<int:id_conf>/plot/<int:id_beam>/<slug:antenna>/pattern.png', views.plot_pattern, name='url_plot_beam'), | |
15 | path('<int:id_conf>/add_beam/', views.add_beam, name='url_add_abs_beam'), |
|
15 | path('<int:id_conf>/add_beam/', views.add_beam, name='url_add_abs_beam'), | |
16 | path('<int:id_conf>/beam/<int:id_beam>/delete/', views.remove_beam, name='url_remove_abs_beam'), |
|
16 | path('<int:id_conf>/beam/<int:id_beam>/delete/', views.remove_beam, name='url_remove_abs_beam'), | |
17 | path('<int:id_conf>/beam/<int:id_beam>/edit/', views.edit_beam, name='url_edit_abs_beam'), |
|
17 | path('<int:id_conf>/beam/<int:id_beam>/edit/', views.edit_beam, name='url_edit_abs_beam'), |
@@ -468,8 +468,8 class JroPattern(): | |||||
468 | yy1 = self.dcosy[numpy.min(nny):numpy.max(nny)+1] |
|
468 | yy1 = self.dcosy[numpy.min(nny):numpy.max(nny)+1] | |
469 |
|
469 | |||
470 | # fitting data into the main beam. |
|
470 | # fitting data into the main beam. | |
471 | import gaussfit |
|
471 | from .gaussfit import fitgaussian | |
472 |
params = |
|
472 | params = fitgaussian(mm1) | |
473 |
|
473 | |||
474 | # Tranforming from indexes to axis' values |
|
474 | # Tranforming from indexes to axis' values | |
475 | xcenter = xx1[0] + (((xx1[xx1.size-1] - xx1[0])/(xx1.size -1))*(params[1])) |
|
475 | xcenter = xx1[0] + (((xx1[xx1.size-1] - xx1[0])/(xx1.size -1))*(params[1])) | |
@@ -629,7 +629,7 class BField(): | |||||
629 | rr = numpy.zeros((heights.size,3)) |
|
629 | rr = numpy.zeros((heights.size,3)) | |
630 | rgc = numpy.zeros((heights.size,3)) |
|
630 | rgc = numpy.zeros((heights.size,3)) | |
631 |
|
631 | |||
632 |
ObjGeodetic = |
|
632 | ObjGeodetic = Geodetic(gdlat,gdalt) | |
633 | [gclat,gcalt] = ObjGeodetic.change2geocentric() |
|
633 | [gclat,gcalt] = ObjGeodetic.change2geocentric() | |
634 |
|
634 | |||
635 | gclat = gclat*numpy.pi/180. |
|
635 | gclat = gclat*numpy.pi/180. | |
@@ -1362,7 +1362,7 class overJroShow: | |||||
1362 |
|
1362 | |||
1363 | vect_polar = Misc_Routines.Vector(numpy.array(vect_geo),direction=1).Polar2Rect() |
|
1363 | vect_polar = Misc_Routines.Vector(numpy.array(vect_geo),direction=1).Polar2Rect() | |
1364 |
|
1364 | |||
1365 |
[ra,dec,ha] = |
|
1365 | [ra,dec,ha] = AltAz(vect_polar[1],vect_polar[0],self.junkjd).change2equatorial() | |
1366 |
|
1366 | |||
1367 | print('Main beam position (HA(min), DEC(degrees)): %f %f')%(ha*4.,dec) |
|
1367 | print('Main beam position (HA(min), DEC(degrees)): %f %f')%(ha*4.,dec) | |
1368 |
|
1368 | |||
@@ -1421,7 +1421,7 class overJroShow: | |||||
1421 |
|
1421 | |||
1422 | vect_polar = Misc_Routines.Vector(vect_geo,direction=1).Polar2Rect() |
|
1422 | vect_polar = Misc_Routines.Vector(vect_geo,direction=1).Polar2Rect() | |
1423 |
|
1423 | |||
1424 |
[ra,dec,ha] = |
|
1424 | [ra,dec,ha] = AltAz(vect_polar[1,:],vect_polar[0,:],self.junkjd).change2equatorial() | |
1425 |
|
1425 | |||
1426 | val = numpy.where(ha>=180) |
|
1426 | val = numpy.where(ha>=180) | |
1427 |
|
1427 | |||
@@ -1609,7 +1609,7 class overJroShow: | |||||
1609 |
|
1609 | |||
1610 | julian = Time(year,month,dom).change2julday() |
|
1610 | julian = Time(year,month,dom).change2julday() | |
1611 |
|
1611 | |||
1612 |
[powr,time, lst] = |
|
1612 | [powr,time, lst] = CelestialBodies().skyNoise(julian) | |
1613 |
|
1613 | |||
1614 | SkyNoisePlot([year,month,dom],powr,time,lst).getPlot(self.path4plotname,self.plotname2) |
|
1614 | SkyNoisePlot([year,month,dom],powr,time,lst).getPlot(self.path4plotname,self.plotname2) | |
1615 |
|
1615 |
@@ -1,9 +1,8 | |||||
1 |
|
||||
2 |
|
||||
3 |
|
|
1 | import ast | |
4 | import json |
|
2 | import json | |
5 | import requests |
|
3 | import requests | |
6 | import numpy as np |
|
4 | import numpy as np | |
|
5 | import time | |||
7 | from base64 import b64encode |
|
6 | from base64 import b64encode | |
8 | from struct import pack |
|
7 | from struct import pack | |
9 |
|
8 | |||
@@ -555,6 +554,8 class RCConfiguration(Configuration): | |||||
555 | print("write device") |
|
554 | print("write device") | |
556 |
|
555 | |||
557 | if not raw: |
|
556 | if not raw: | |
|
557 | pass | |||
|
558 | ''' | |||
558 | clock = RCClock.objects.get(rc_configuration=self) |
|
559 | clock = RCClock.objects.get(rc_configuration=self) | |
559 | if clock.mode: |
|
560 | if clock.mode: | |
560 | data = {'default': clock.frequency} |
|
561 | data = {'default': clock.frequency} | |
@@ -567,8 +568,10 class RCConfiguration(Configuration): | |||||
567 | self.message = payload['setfreq'] |
|
568 | self.message = payload['setfreq'] | |
568 | if payload['setfreq'] == 'fail': |
|
569 | if payload['setfreq'] == 'fail': | |
569 | self.message = 'RC write: error programming CGS chip' |
|
570 | self.message = 'RC write: error programming CGS chip' | |
|
571 | ''' | |||
570 |
|
572 | |||
571 | values = [] |
|
573 | values = [] | |
|
574 | print('ok') | |||
572 | for pulse, delay in zip(self.get_pulses(), self.get_delays()): |
|
575 | for pulse, delay in zip(self.get_pulses(), self.get_delays()): | |
573 | while delay > 65536: |
|
576 | while delay > 65536: | |
574 | values.append((pulse, 65535)) |
|
577 | values.append((pulse, 65535)) | |
@@ -608,9 +611,11 class RCConfiguration(Configuration): | |||||
608 | #payload = self.request('write', 'post', data=b64encode(bytearray((139, 62))), timeout=20) |
|
611 | #payload = self.request('write', 'post', data=b64encode(bytearray((139, 62))), timeout=20) | |
609 | n = len(data) |
|
612 | n = len(data) | |
610 | x = 0 |
|
613 | x = 0 | |
611 |
|
|
614 | while x < n: | |
612 | payload = self.request('write', 'post', data=b64encode(data)) |
|
615 | payload = self.request('write', 'post', data=b64encode(data[x:x+1024])) | |
613 |
|
|
616 | x += 1024 | |
|
617 | time.sleep(1) | |||
|
618 | print('writing... ', x) | |||
614 |
|
619 | |||
615 | if payload['write']=='ok': |
|
620 | if payload['write']=='ok': | |
616 | self.device.status = 3 |
|
621 | self.device.status = 3 | |
@@ -1039,4 +1044,4 class RCClock(models.Model): | |||||
1039 | multiplier = models.PositiveIntegerField(default=60) |
|
1044 | multiplier = models.PositiveIntegerField(default=60) | |
1040 | divisor = models.PositiveIntegerField(default=10) |
|
1045 | divisor = models.PositiveIntegerField(default=10) | |
1041 | reference = models.PositiveSmallIntegerField(default=1, choices=((0, 'Internal (25MHz)'), (1, 'External (10MHz)'))) |
|
1046 | reference = models.PositiveSmallIntegerField(default=1, choices=((0, 'Internal (25MHz)'), (1, 'External (10MHz)'))) | |
1042 | frequency = models.FloatField(default=60.0) No newline at end of file |
|
1047 | frequency = models.FloatField(default=60.0) |
@@ -1,4 +1,3 | |||||
1 |
|
||||
2 |
|
|
1 | import json | |
3 |
|
2 | |||
4 | from django.contrib import messages |
|
3 | from django.contrib import messages | |
@@ -118,7 +117,7 def conf_edit(request, conf_id): | |||||
118 | form.save() |
|
117 | form.save() | |
119 |
|
118 | |||
120 | #update lines fields |
|
119 | #update lines fields | |
121 | extras.sort() |
|
120 | extras.sort(key=lambda x: int(x.split('|')[0])) | |
122 | #print("Inicio extras") |
|
121 | #print("Inicio extras") | |
123 | #print(extras) |
|
122 | #print(extras) | |
124 | #print("Fin extras") |
|
123 | #print("Fin extras") | |
@@ -433,4 +432,4 def plot_pulses2(request, conf_id): | |||||
433 | def conf_raw(request, conf_id): |
|
432 | def conf_raw(request, conf_id): | |
434 | conf = get_object_or_404(RCConfiguration, pk=conf_id) |
|
433 | conf = get_object_or_404(RCConfiguration, pk=conf_id) | |
435 | raw = conf.write_device(raw=True) |
|
434 | raw = conf.write_device(raw=True) | |
436 | return HttpResponse(raw, content_type='application/json') No newline at end of file |
|
435 | return HttpResponse(raw, content_type='application/json') |
@@ -1,42 +1,44 | |||||
1 | version: '2' |
|
1 | version: '2' | |
2 | services: |
|
2 | services: | |
3 | # Django app |
|
3 | # Django app | |
4 | web: |
|
4 | # web: | |
5 |
|
|
5 | # container_name: 'radarsys' | |
6 |
|
|
6 | # build: . | |
7 |
|
|
7 | # restart: always | |
8 |
|
|
8 | # image: radarsys | |
9 |
|
|
9 | # command: gunicorn radarsys.wsgi:application -w 2 -b :8000 | |
10 | # command: python manage.py runserver 0.0.0.0:8030 |
|
10 | # # command: python manage.py runserver 0.0.0.0:8030 | |
11 | # ports: |
|
11 | # # ports: | |
12 | # - 8030:8030 |
|
12 | # # - 8030:8030 | |
13 |
|
|
13 | # env_file: .env | |
14 |
|
14 | |||
15 | links: |
|
15 | # links: | |
16 |
|
|
16 | # - redis | |
17 |
|
|
17 | # - postgres | |
18 | volumes: |
|
18 | # volumes: | |
19 |
|
|
19 | # - './:/radarsys' | |
20 |
|
|
20 | # - '${DOCKER_DATA}/static:/radarsys/static' | |
21 | depends_on: |
|
21 | # depends_on: | |
22 |
|
|
22 | # - redis | |
23 |
|
|
23 | # - postgres | |
24 |
|
24 | |||
25 | redis: |
|
25 | redis: | |
26 | container_name: 'radarsys-redis' |
|
26 | container_name: 'radarsys-redis' | |
27 | image: 'redis:3.2-alpine' |
|
27 | image: 'redis:3.2-alpine' | |
28 | volumes: |
|
28 | volumes: | |
29 | - '${DOCKER_DATA}/redis:/data' |
|
29 | - '${DOCKER_DATA}/redis:/data' | |
|
30 | ports: | |||
|
31 | - 6300:6379 | |||
30 |
|
32 | |||
31 | celery_worker: |
|
33 | celery_worker: | |
32 | container_name: 'radarsys-celery' |
|
34 | container_name: 'radarsys-celery' | |
33 | image: radarsys |
|
35 | image: radarsys | |
34 | env_file: .env |
|
36 | env_file: .env | |
35 | command: celery -A radarsys worker -l info |
|
37 | command: celery -A radarsys worker -l info | |
36 | volumes_from: |
|
38 | # volumes_from: | |
37 | - web |
|
39 | # - web | |
38 | depends_on: |
|
40 | # depends_on: | |
39 | - web |
|
41 | # - web | |
40 |
|
42 | |||
41 | # PostgreSQL |
|
43 | # PostgreSQL | |
42 | postgres: |
|
44 | postgres: | |
@@ -44,25 +46,25 services: | |||||
44 | build: ./postgres/ |
|
46 | build: ./postgres/ | |
45 | volumes: |
|
47 | volumes: | |
46 | - ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d |
|
48 | - ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d | |
47 |
- |
|
49 | - /data/dockers/radarsys/postgres:/var/lib/postgresql/data | |
48 |
|
|
50 | ports: | |
49 |
|
|
51 | - 5400:5432 | |
50 | env_file: .env |
|
52 | env_file: .env | |
51 |
|
53 | |||
52 | # Web Server |
|
54 | # Web Server | |
53 | nginx: |
|
55 | # nginx: | |
54 | container_name: 'radarsys-nginx' |
|
56 | # container_name: 'radarsys-nginx' | |
55 | restart: always |
|
57 | # restart: always | |
56 | build: ./nginx/ |
|
58 | # build: ./nginx/ | |
57 | ports: |
|
59 | # ports: | |
58 | - '8030:8030' |
|
60 | # - '8030:8030' | |
59 | volumes_from: |
|
61 | # volumes_from: | |
60 | - web |
|
62 | # - web | |
61 | links: |
|
63 | # links: | |
62 | - web:web |
|
64 | # - web:web | |
63 | depends_on: |
|
65 | # depends_on: | |
64 | - web |
|
66 | # - web | |
65 |
|
67 | |||
66 | volumes: |
|
68 | # volumes: | |
67 | pgdata: |
|
69 | # pgdata: | |
68 | driver: local |
|
70 | # driver: local |
@@ -28,7 +28,7 ALLOWED_HOSTS = ['*'] | |||||
28 |
|
28 | |||
29 | # Application definition |
|
29 | # Application definition | |
30 |
|
30 | |||
31 |
INSTALLED_APPS = |
|
31 | INSTALLED_APPS = ( | |
32 | 'django.contrib.admin', |
|
32 | 'django.contrib.admin', | |
33 | 'django.contrib.auth', |
|
33 | 'django.contrib.auth', | |
34 | 'django.contrib.contenttypes', |
|
34 | 'django.contrib.contenttypes', | |
@@ -42,12 +42,12 INSTALLED_APPS = [ | |||||
42 | 'apps.misc', |
|
42 | 'apps.misc', | |
43 | 'apps.rc', |
|
43 | 'apps.rc', | |
44 | 'apps.dds', |
|
44 | 'apps.dds', | |
|
45 | 'apps.dds_rest', | |||
45 | 'apps.jars', |
|
46 | 'apps.jars', | |
46 | 'apps.usrp', |
|
47 | 'apps.usrp', | |
47 | 'apps.abs', |
|
48 | 'apps.abs', | |
48 | 'apps.cgs', |
|
49 | 'apps.cgs', | |
49 | 'apps.dds_rest', |
|
50 | ) | |
50 | ] |
|
|||
51 |
|
51 | |||
52 | MIDDLEWARE = [ |
|
52 | MIDDLEWARE = [ | |
53 | 'django.middleware.security.SecurityMiddleware', |
|
53 | 'django.middleware.security.SecurityMiddleware', | |
@@ -65,7 +65,7 ROOT_URLCONF = 'radarsys.urls' | |||||
65 | TEMPLATES = [ |
|
65 | TEMPLATES = [ | |
66 | { |
|
66 | { | |
67 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
|
67 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
68 | 'DIRS': [os.path.join(BASE_DIR, "templates")], |
|
68 | 'DIRS': [os.path.join(BASE_DIR, "templates").replace('\\', '/'),], | |
69 | 'APP_DIRS': True, |
|
69 | 'APP_DIRS': True, | |
70 | 'OPTIONS': { |
|
70 | 'OPTIONS': { | |
71 | 'context_processors': [ |
|
71 | 'context_processors': [ | |
@@ -89,30 +89,28 DATABASES = { | |||||
89 | 'default': { |
|
89 | 'default': { | |
90 | 'ENGINE': 'django.db.backends.sqlite3', |
|
90 | 'ENGINE': 'django.db.backends.sqlite3', | |
91 | 'NAME': 'radarsys.sqlite', |
|
91 | 'NAME': 'radarsys.sqlite', | |
|
92 | # 'ENGINE': 'django.db.backends.postgresql_psycopg2', | |||
|
93 | # 'NAME': os.environ.get('DB_NAME', 'radarsys'), | |||
|
94 | # 'USER': os.environ.get('DB_USER', 'docker'), | |||
|
95 | # 'PASSWORD': os.environ.get('DB_PASSWORD', 'docker'), | |||
|
96 | # 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR', 'localhost'), | |||
|
97 | # 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT', '5400'), | |||
|
98 | } | |||
92 | } |
|
99 | } | |
93 | # 'default': { |
|
|||
94 | # 'ENGINE': 'django.db.backends.postgresql_psycopg2', |
|
|||
95 | # 'NAME': os.environ.get('DB_NAME', 'radarsys'), |
|
|||
96 | # 'USER': os.environ.get('DB_USER', 'docker'), |
|
|||
97 | # 'PASSWORD': os.environ.get('DB_PASSWORD', 'docker'), |
|
|||
98 | # 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR', 'localhost'), |
|
|||
99 | # 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT', '5400'), |
|
|||
100 | #} |
|
|||
101 | } |
|
|||
102 |
|
100 | |||
103 | # Internationalization |
|
101 | # Internationalization | |
104 | # https://docs.djangoproject.com/en/1.8/topics/i18n/ |
|
102 | # https://docs.djangoproject.com/en/1.8/topics/i18n/ | |
105 |
|
103 | |||
106 | LANGUAGE_CODE = 'en-us' |
|
104 | LANGUAGE_CODE = 'en-us' | |
107 |
|
105 | |||
108 | USE_TZ = False #True |
|
|||
109 |
|
||||
110 | TIME_ZONE = os.environ.get('TZ', 'America/Lima') |
|
106 | TIME_ZONE = os.environ.get('TZ', 'America/Lima') | |
111 |
|
107 | |||
112 | USE_I18N = True |
|
108 | USE_I18N = True | |
113 |
|
109 | |||
114 | USE_L10N = True |
|
110 | USE_L10N = True | |
115 |
|
111 | |||
|
112 | USE_TZ = False | |||
|
113 | ||||
116 | # Static files (CSS, JavaScript, Images) |
|
114 | # Static files (CSS, JavaScript, Images) | |
117 | # https://docs.djangoproject.com/en/1.8/howto/static-files/ |
|
115 | # https://docs.djangoproject.com/en/1.8/howto/static-files/ | |
118 |
|
116 | |||
@@ -128,19 +126,15 STATICFILES_FINDERS = ( | |||||
128 | ) |
|
126 | ) | |
129 |
|
127 | |||
130 | # Celery stuff |
|
128 | # Celery stuff | |
131 |
|
129 | REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1') | ||
132 |
REDIS_ |
|
130 | REDIS_PORT = os.environ.get('REDIS_PORT', 6300) | |
133 | #REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1') |
|
|||
134 | REDIS_PORT = os.environ.get('REDIS_PORT', 6379) |
|
|||
135 |
|
131 | |||
136 | BROKER_TRANSPORT = 'redis' |
|
132 | BROKER_TRANSPORT = 'redis' | |
137 |
|
|
133 | BROKER_URL = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT) | |
138 | BROKER_URL = 'redis://{}:{}'.format(REDIS_HOST, REDIS_PORT) |
|
|||
139 |
|
134 | |||
140 |
CELERY_RESULT_BACKEND |
|
135 | CELERY_RESULT_BACKEND = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT) | |
141 |
CELERY_BROKER_TRANSPORT |
|
136 | CELERY_BROKER_TRANSPORT = BROKER_URL | |
142 |
CELERY_ACCEPT_CONTENT |
|
137 | CELERY_ACCEPT_CONTENT = ['application/json'] | |
143 |
CELERY_TASK_SERIALIZER |
|
138 | CELERY_TASK_SERIALIZER = 'json' | |
144 | CELERY_RESULT_SERIALIZER = 'json' |
|
139 | CELERY_RESULT_SERIALIZER = 'json' | |
145 |
CELERY_ENABLE_UTC |
|
140 | CELERY_ENABLE_UTC = False | |
146 | CELERY_TIMEZONE = 'America/Lima' No newline at end of file |
|
General Comments 0
You need to be logged in to leave comments.
Login now