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