Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variant Import #284

Merged
merged 13 commits into from
Mar 5, 2019
2 changes: 2 additions & 0 deletions backend/promis/classes/base_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def avg_float(l, n, span):
return s / span

v = self.data(selection)
if len(v) > 0 and type(v) is list and len(v[0]) == 1:
v = [x[0] for x in v]
gloriajjl marked this conversation as resolved.
Show resolved Hide resolved

# If given too much points, return the original data
# TODO: make configurable somewhere
Expand Down
6 changes: 4 additions & 2 deletions backend/promis/classes/variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def fetch(self, daydir):
for line in fp:
if idx >= len(component_sf):
break
if daydir in ["1057", "1071", "1109", "1278", "1394"] and idx == 3:
idx += 2
if len(line.rstrip()) != 0:
component_sf[idx][1] = float(line)
idx += 1
Expand Down Expand Up @@ -205,7 +207,7 @@ def find_sf(components):
if name == comp_name:
max_sf = max(max_sf, sf)
break
#print("components: " + str(components) + " sf: " + str(max_sf))
#print("components: " + str(components) + " max_sf: " + str(max_sf))
return max_sf

sampling_frequency = find_sf(chan_files['comps'])
Expand All @@ -219,4 +221,4 @@ def catchIdxError(component, idx):

json_data = [tuple([catchIdxError(component,idx) for component in listOfComponents]) for idx in range(numValues)]
doc_obj = model.Document.objects.create(json_data = json_data )
meas = model.Measurement.objects.create(session = sess_obj, parameter = par_obj, channel = chan_obj, channel_doc = doc_obj, parameter_doc = doc_obj, sampling_frequency = sampling_frequency, max_frequency = 31250, min_frequency = 31250)
meas = model.Measurement.objects.create(session = sess_obj, parameter = par_obj, channel = chan_obj, channel_doc = doc_obj, parameter_doc = doc_obj, sampling_frequency = sampling_frequency, max_frequency = sampling_frequency, min_frequency = sampling_frequency)