diff --git a/apps/main/templates/experiment.html b/apps/main/templates/experiment.html index a4048ff..deb6c6f 100644 --- a/apps/main/templates/experiment.html +++ b/apps/main/templates/experiment.html @@ -26,6 +26,7 @@
  • ----------------
  • Mix RC Configurations
  • Add Configuration
  • +
  • Summary
  • diff --git a/apps/main/templates/experiment_summary.html b/apps/main/templates/experiment_summary.html new file mode 100644 index 0000000..5fb82da --- /dev/null +++ b/apps/main/templates/experiment_summary.html @@ -0,0 +1,125 @@ +{% extends "base.html" %} +{% load bootstrap3 %} +{% load static %} +{% load main_tags %} +{% block extra-head %} + +{% endblock %} + +{% block exp-active %}active{% endblock %} + +{% block content-title %}{{title}}{% endblock %} +{% block content-suptitle %}{{suptitle}}{% endblock %} + +{% block content %} + +{% block menu-actions %} + +{% endblock %} + + +{% for key in experiment_keys %} + +{% endfor %} +
    {{key|title}}{{experiment|attr:key}}
    + +
    +

    Parameters

    +
    +
    + + +{% for configuration in configurations %} + {% if configuration.device.device_type.name == 'dds' %} + + + {% endif %} + + {% if configuration.device.device_type.name == 'rc' %} + + + + + + + {% endif %} + + {% if configuration.device.device_type.name == 'rc_mix' %} + + + {% endif %} + + {% if configuration.device.device_type.name == 'jars' %} + + + + + + {% if exp_type == 'PDATA'%} + + + {% endif %} + + + + {% endif %} + + {% if configuration.device.device_type.name == 'usrp' %} + + + {% endif %} + + {% if configuration.device.device_type.name == 'cgs' %} + + + + + + {% endif %} + + {% if configuration.device.device_type.name == 'abs' %} + + + {% endif %} +{% endfor %} +
    dds(=
    IPP(km){{experiment_data.configurations.rc.ipp}}
    NTX{{experiment_data.configurations.rc.ntx}}
    TX{{tx}}
    Code{{code}}
    Sampling Window{{window|linebreaks}}
    rc_mix(=
    Data Type{{exp_type}}
    # Channels{{configuration.channels_number}}
    Coh Int{{configuration.cohe_integr}}
    FFT Points{{configuration.fftpoints}}
    Inc Int{{configuration.incohe_integr}}
    Spec. Comb.{{configuration.spectral}}
    Acq Prof{{configuration.acq_profiles}}
    Prof x Block{{configuration.profiles_block}}
    Block x File(=
    usrp(=
    abs(=
    + +
    + + +
    + +{% endblock %} + +{% block sidebar%} + {% include "sidebar_devices.html" %} +{% endblock %} + +{% block extra-js%} + +{% endblock %} \ No newline at end of file diff --git a/apps/main/urls.py b/apps/main/urls.py index b46b558..c7eb84b 100644 --- a/apps/main/urls.py +++ b/apps/main/urls.py @@ -30,6 +30,7 @@ urlpatterns = ( url(r'^experiment/(?P-?\d+)/import/$', 'apps.main.views.experiment_import', name='url_import_experiment'), url(r'^experiment/(?P-?\d+)/mix/$', 'apps.main.views.experiment_mix', name='url_mix_experiment'), url(r'^experiment/(?P-?\d+)/mix/delete/$', 'apps.main.views.experiment_mix_delete', name='url_delete_mix_experiment'), + url(r'^experiment/(?P-?\d+)/summary/$', 'apps.main.views.experiment_summary', name='url_sum_experiment'), url(r'^experiment/(?P-?\d+)/new_dev_conf/$', 'apps.main.views.dev_conf_new', name='url_add_dev_conf'), url(r'^experiment/(?P-?\d+)/new_dev_conf/(?P-?\d+)/$', 'apps.main.views.dev_conf_new', name='url_add_dev_conf'), diff --git a/apps/main/views.py b/apps/main/views.py index 7850a7c..6db50db 100644 --- a/apps/main/views.py +++ b/apps/main/views.py @@ -19,7 +19,7 @@ from apps.dds.forms import DDSConfigurationForm from .models import Campaign, Experiment, Device, Configuration, Location, RunningExperiment from apps.cgs.models import CGSConfiguration -from apps.jars.models import JARSConfiguration +from apps.jars.models import JARSConfiguration, EXPERIMENT_TYPE from apps.usrp.models import USRPConfiguration from apps.abs.models import ABSConfiguration from apps.rc.models import RCConfiguration, RCLine, RCLineType @@ -753,6 +753,60 @@ def experiment_mix_delete(request, id_exp): return redirect('url_mix_experiment', id_exp=id_exp) +def experiment_summary(request, id_exp): + + import json + + experiment = get_object_or_404(Experiment, pk=id_exp) + experiment_data = json.loads(experiment.parms_to_dict()) + configurations = Configuration.objects.filter(experiment=experiment, type=0) + + kwargs = {} + + kwargs['experiment_keys'] = ['template', 'radar_system', 'name', 'start_time', 'end_time'] + kwargs['experiment'] = experiment + + kwargs['configuration_keys'] = ['name', 'device__ip_address', 'device__port_address', 'device__status'] + kwargs['configurations'] = configurations + kwargs['experiment_data'] = experiment_data + + kwargs['title'] = 'Experiment Summary' + kwargs['suptitle'] = 'Details' + + kwargs['button'] = 'Verify Parameters' + + for configuration in configurations: + if configuration.device.device_type.name == 'jars': + kwargs['exp_type'] = EXPERIMENT_TYPE[configuration.exp_type][1] + + if configuration.device.device_type.name == 'rc': + rc_lines = experiment_data['configurations']['rc']['lines'] + code = rc_lines[3]['code'] + + window_data = rc_lines[6]['params'][0] + h0 = str(window_data['first_height']) + dh = str(window_data['resolution']) + nsa = str(window_data['number_of_samples']) + window = 'Ho='+h0+'km\nDH='+dh+'km\nNSA='+nsa + + tx = '' + if float(rc_lines[1]['delays']) == 0: + tx = rc_lines[2]['pulse_width'] + elif float(rc_lines[2]['delays']) == 0: + tx = rc_lines[1]['pulse_width'] + else: + tx = rc_lines[1]['pulse_width']+' | '+rc_lines[2]['pulse_width'] + + kwargs['tx'] = tx + kwargs['code'] = code + kwargs['window'] = window + + ###### SIDEBAR ###### + kwargs.update(sidebar(experiment=experiment)) + + return render(request, 'experiment_summary.html', kwargs) + + def parse_mix_result(s): values = s.split('-') @@ -1426,4 +1480,3 @@ def radar_refresh(request, id_camp, id_radar): return HttpResponseRedirect(reverse('url_operation_search', args=[id_camp])) else: return HttpResponseRedirect(reverse('url_operation', args=[id_camp])) -