Open Ovicula opened 8 years ago
Dear @Ovicula,
happy to help you!
1) General remark: Please try to avoid pushing to the master-branch directly. This will keep the code cleaner.
2) Could you already locate the line of code which raises the error? It's this one: https://github.com/rgiessmann/peaks/blob/master/test/footprint#L407
If you examine the context, you'll note that the variable trace
is not defined. Compare your function with function determine_factor_numerically
from https://github.com/rgiessmann/peaks/blob/master/footprint.py#L284 -- instead of defining the function's argument trace
you named it trace_list
.
Suggested solution: a) either cycle through all traces in trace_list:
for trace in trace_list:
... (insert the rest of the function here)
or b) rename your arguments from:
def determine_factor_numerically(ref, trace_list, weight_smaller=1, weight_bigger=1, relative_mode=True):
to:
def determine_factor_numerically(ref, trace, weight_smaller=1, weight_bigger=1, relative_mode=True):
Hope I could help you, Robert
Unfortunately it is not that easy...
For solution a) I get:
File "C:\Users\K\Desktop\Programm\New_data_and_method.py", line 33, in <module> ref = footprint.generate_averaged_negative_control(trace_list,accepted_offset=0.5) File "C:\Users\K\Desktop\Programm\footprint.py", line 213, in generate_averaged_negative_control correct_peaks_with_factor(trace,determine_factor_numerically(conc_0_traces[0],trace)) File "C:\Users\K\Desktop\Programm\footprint.py", line 407, in determine_factor_numerically for trace in trace_list: TypeError: iteration over non-sequence
For solution b) I get:
Traceback (most recent call last): File "C:\Users\K\Desktop\Programm\New_data_and_method.py", line 33, in <module> ref = footprint.generate_averaged_negative_control(trace_list,accepted_offset=0.5) File "C:\Users\K\Desktop\Programm\footprint.py", line 213, in generate_averaged_negative_control correct_peaks_with_factor(trace,determine_factor_numerically(conc_0_traces[0],trace)) File "C:\Users\K\Desktop\Programm\footprint.py", line 404, in determine_factor_numerically rmsd_old = calculate_deviance_for_all_peaks(ref, trace_list,weight_smaller,weight_bigger, relative_mode) NameError: global name 'trace_list' is not defined
If I try
def determine_factor_numerically(ref, trace, trace_list, weight_smaller=1, weight_bigger=1, relative_mode=True)
I get
Traceback (most recent call last): File "C:\Users\K\Desktop\Programm\New_data_and_method.py", line 33, in <module> ref = footprint.generate_averaged_negative_control(trace_list,accepted_offset=0.5) File "C:\Users\K\Desktop\Programm\footprint.py", line 213, in generate_averaged_negative_control correct_peaks_with_factor(trace,determine_factor_numerically(conc_0_traces[0],trace)) TypeError: determine_factor_numerically() takes at least 3 arguments (2 given)
How could I solve that? I really don't know.... Thanks!
Dear @Ovicula ,
now your error is propagating up, through the other levels of code, where you call the function -- please go for solution b), I will discuss it here:
determine_factor_numerically
should be changed to def determine_factor_numerically(ref, trace, weight_smaller=1, weight_bigger=1, relative_mode=True)
, NB: omitting the trace_list
completely!
As you inserted an argument more than is necessary, this is why python complains with determine_factor_numerically() takes at least 3 arguments (2 given)
.
trace_list
s with trace
in the function determine_factor_numerically
.Does it work now?
Best, Robert
Hallo
Ich habe mich jetzt endlich mal wieder an das Programm gesetzt und versucht etwas zu schreiben, mit dem ich die Daten von dem Hoechst-Experiment analysieren kann. Hat leider nicht so ganz geklappt. Ich bekomme diese Fehlermeldung:
traceback (most recent call last): File "C:\Users\K\Desktop\Programm\New_data_and_method.py", line 33, in <module> ref = footprint.generate_averaged_negative_control(trace_list,accepted_offset=0.5) File "C:\Users\K\Desktop\Programm\footprint.py", line 213, in generate_averaged_negative_control correct_peaks_with_factor(trace,determine_factor_numerically(conc_0_traces[0],trace)) File "C:\Users\K\Desktop\Programm\footprint.py", line 407, in determine_factor_numerically for peak in trace.peaks: NameError: global name 'trace' is not defined
Grundsätzlich verstehe ich zwar, was der Fehler bedeutet, aber ich weiß nicht, wie ich ihn beheben kann...alles was ich bisher probiert habe, hat nicht funktioniert, und im Internet habe ich auch nichts gefunden, was mir weiterhilft. Könntest du evtl mal schauen, ob du den Fehler beheben kannst? Die Codes sind im Test-Ordner zu finden (new_data_new_method & footprint(bin mir nicht sicher, ob ich da was dran verändert habe))
Falls du in den nächsten Tagen keine Zeit haben solltest da mal drüber zu schauen, sag mir bitte bescheid, damit ich nach jemand anderem suchen kann, der mir hilft.
Danke!