GithubHelp home page GithubHelp logo

Probleme mit Programmierung about peaks HOT 3 OPEN

rgiessmann avatar rgiessmann commented on August 23, 2024
Probleme mit Programmierung

from peaks.

Comments (3)

rgiessmann avatar rgiessmann commented on August 23, 2024

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

from peaks.

Ovicula avatar Ovicula commented on August 23, 2024

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!

from peaks.

rgiessmann avatar rgiessmann commented on August 23, 2024

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:

  1. 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).

  1. If you rename trace_list with trace, please change it accordingly throughout the function's code -- i.e. replace all trace_lists with trace in the function determine_factor_numerically.

Does it work now?

Best,
Robert

from peaks.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.