woooee 814 Nearly a Posting Maven

Only, you'd have to gpl your code

This is not true. You can GPL your code if you want but it is not a requirement. Your code automatically comes under the GPL only when it modifies a program that is already GPL'd. You would have to provide a link to the GPL part of the code, i.e. the QT website (generally in the comments at the beginning of the program), but your code is your code. One of the mobile phone manufactures, I think it is Nokia but I'm not sure, uses QT but has had a closed operating system for years. If it is Nokia, they have recently open-sourced, but it was closed for years even though the QT tool kit was used.

woooee 814 Nearly a Posting Maven

6.1230317691118863e-17

Note the e-17. This is a very small number and the closest that floating point numbers can come (similiar to converting 1/3 to a base 10 decimal). See here http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate and http://www.lahey.com/float.htm You have to use sloppy logic with floating point numbers

print "%10.7f" % ( math.cos(90*math.pi/180)) or
x = math.cos(90*math.pi/180)
if x < .00000000001:
   print "x = zero"

For greater precision you have to use Python's Deciimal module http://www.python.org/doc/2.5.2/lib/module-decimal.html but add on the trig functions from here http://pypi.python.org/pypi/AJDecimalMathAdditions/0.2.0 Also take a look at NumPy http://wiki.python.org/moin/NumPy This is the Numeric/Scientific Wiki http://wiki.python.org/moin/NumericAndScientific

woooee 814 Nearly a Posting Maven

Section 1 in this online book has some beginning class examples. http://www.mindview.net/Books/TIPython

woooee 814 Nearly a Posting Maven
woooee 814 Nearly a Posting Maven

PostGreSQL claims to work with 3.0 but I haven't tried it http://python.projects.postgresql.org/ SqLite is good up to 100,000 to 250,000 records depending on size of record and database use.

woooee 814 Nearly a Posting Maven

Well, I've defined a new method which parses the data a bit better. I think this may be the solution:

ef output(line):
''''''
for value in line:
outstring = str(line[0]) + " " + str(line[1]) + " " + str(line[2]) + " " + str(line[3])

Data seems formatted better

.join will work better for that.
outstring =" ".join(line)
You can also do something like

for element in len(line):
   fp.write("%s " % (str(line[element])))
fp.write( "\n")
woooee 814 Nearly a Posting Maven

To start, list_of_numbers is not a list of numbers but an integer. Or,
list_of_numbers = int (list_of_numbers)
will throw an error because you can not convert a list, and there would be no need for a while loop either. Most people who see
list_of_numbers = (input("Enter a list of numbers, (Enter -1 to stop): "))
would enter a list of numbers, i.e. 1,2,3

Your next step is to store each input number in a list. Then it becomes fairly simple; total the numbers in the list and calculate the average. For the max and min, you can either traverse the list and find the max and min, or test each number as it is input and store in variables if they are the largest or smallest so far.

woooee 814 Nearly a Posting Maven

This is one error. I don't have time to dig any further now, but if there are other problems, post back.

def make_bombs(self):
        bombs_created = 0
        while bombs_created < self.bombs:
                col = randint(1, self.columns)
                row = randint(1, self.rows)
                loc = (col, row)

                BombButton(loc)
                self.bomb_buttons.append(BombButton)

                ## the above 2 lines chould either be
                self.bomb_buttons.append(BombButton(loc))
                ## or
                this_button = BombButton(loc)
                self.bomb_buttons.append(this_button)

                bombs_created += 1

Also, add some print statements to each of the classes, so you know how far you get each time.

woooee 814 Nearly a Posting Maven

What does it return, an error message? exec() will work on things like print statements or 1+2-3, but if you call a function or class then you must already have that function defined, otherwise an error message. Perhaps if you explained what you are trying to do, there would be an easier way, like a generic class that you would pass the strings in the file to as parameters --> some_class( the_string ).

woooee 814 Nearly a Posting Maven

The problem is the @staticmethod decorator in both of your examples. Delete that line and the first program runs OK
[plus you only supply 'instance' once, i.e.
instance.do_stuff_with_var() ].
I have not tested the second program, but that would be the place to start. Since you only have one "do_stuff_with_variables" function in the first example, and only one "find_adjacent_cells" function, @staticmethod seems unnecessary anyway. Try either example without this and if it does not do what you want, post back.

woooee 814 Nearly a Posting Maven

Split the string on whitespace and check the first character of each word. You can use >= "A", <="Z"; or check that the ord of the character is within the capital letter range; or create a list of capital letters and use "if the first letter is in the list".

woooee 814 Nearly a Posting Maven

0.0 -0.9
0.3 -0.4
0.6 -1.0
0.9 0.3

These colums always appear on the same line number. What I want to do is to get a list of all column1row1:column2row1 of all files, then a list of all column1row2:column2row2 and so on

One way is to append to a list. So in the following code, "l" and "p" should be lists, and you should use append instead of =.

if (line.startswith("0.0") and count == 15):
   elems = line.split()
   l = float(elems[0])
   p = float(elems[1])

## as for this line giving an error message, you haven't added anything
## to hit so it doesn't exist
hit[elems[1]]
print hit
woooee 814 Nearly a Posting Maven

traverse(tree.rest)

tree would have to be an instance of the Tree class for this to work.

class Tree:
	def __init__(self, f, r):
		self.first = f
		self.rest = r 
		
tree = Tree(1, [])
vertex = tree.rest
print "tree", 
if len(vertex) > 0:
   print "Greater"
else:
   print "Lesser/Equal"
   
tree_2 = Tree(1, [123])
vertex = tree_2.rest
print "tree_2",
if len(vertex) > 0:
   print "Greater"
else:
   print "Lesser/Equal"
woooee 814 Nearly a Posting Maven

A third option, if you want to keep the extension.

old_file_name = 'bc13abc2.txt'

## This assumes there is only one "." in the file name
substrs = old_file_name.split(".")
print substrs
## then use siddhant3s' example to find the digits, or some way
## using isdigit() and add substrs[1] (the ending) to that name.
digits_list = [x for x in old_file_name if x.isdigit()]
print digits_list

## which is the same as
second_list = []
for x in old_file_name:
   if x.isdigit()
      second_list.append(x)

## you then have to .join into a string
woooee 814 Nearly a Posting Maven

Use a dictionary, with port number as the key, pointing to a list of servers running on that port.

allports = list(set(total.keys()))
lines = total.values()

data_dict = {}
for port in allports:
    for line in lines:
        this_port = line[1]
        ## add key to dictionary if it doesn't exist, 
        ## pointing to an empty list
        if this_port not in data_dict:  
            data_dict[this_port] = []

        data_dict[this_port].append(line[0])

keys = data_dict.keys()
keys.sort()
print keys
woooee 814 Nearly a Posting Maven

That works just fine. Being paranoid, I like to supply defaults. Using a class works fine until it becomes too cumbersome or you want a better way of looking things up, then you move up to using an SqLite DB in memory.

class MyClass:
	def __init__(self, f=" ", r=[]):
		self.first = f
		self.rest = r

if __name__ == "__main__":
   list_of_classes = []
   list_of_classes.append(MyClass())
   list_of_classes.append(MyClass("x", ["a", "b"]))
   print "----->", list_of_classes[1].first
   print "----->", list_of_classes[0].rest
woooee 814 Nearly a Posting Maven

Most newer BIOS have a password option that will require a password to start the computer. Obviously, if you use this you do not want to loose the password, otherwise you will have to flash the BIOS or jump through some other hoops to be able to do anything at all.

It appears that this is done via OpenFirmware on a Mac but you'll have to research that. I'm a Linux user. http://www.google.com/search?client=opera&rls=en&q=mac+bios+password&sourceid=opera&ie=utf-8&oe=utf-8
http://maczealots.com/tutorials/security/

woooee 814 Nearly a Posting Maven

The key is these lines
MM=[]
print "start of loop", MM
If it is just overlaying the previous item, then this print should print the previous item. What exactly does the first line above do each time you cycle through the for loop?

Edit: try this instead

n=range(0,31)
x=[]
MM=[]
for x in n:
   print "\nreally at the start of loop", MM
   AL=5000.00
   MM=[]
   print "start of loop", MM
   MM_Income=12000.00
   MM_Cost=8000.00
   MM_Inc=800.00
   MM_Own=11
   MM_ROI=(MM_Income/(MM_Cost+(MM_Inc*x)+AL)*100)
   MM.append(MM_ROI)
   print "after appending", MM
   print (MM_ROI)

MML=zip(n,MM)
print (MML) 

print "x is", x, type(x)
woooee 814 Nearly a Posting Maven

Somestruct = Struct .new(:character, :characterArray)
structure = Somestruct.new(" ", [])

This is just a simple list or tuple in python. Try this

structure = []
Somestruct = (" ", [])
structure.append(Somestruct)
Somestruct = ("1", ["abc", "def"])
structure.append(Somestruct)
print structure

If you want more than that, then use a list of classes, with each class defining/declaring what you want.

woooee 814 Nearly a Posting Maven

If you had stated what you were trying to do in the beginning, you would probably have a solution by now. First, are you trying to count the "{" and "}" characters? If so, try the code below and after that is working state what you want to do next. Whatever it is, you don't want it inside a
for match in re.finditer("{", line):
statement as that will perform the same re multiple times (once for every "{" found). Whoever supplied the re statements was either playing a joke or trying to prove how much smarter they were than you. Neither solves your problem, and there are other ways that will work, and that you will also understand. There is a programmer saying that goes something like, "Someone has a problem. They say 'I'll solve this with a regular expression.' Now they have two problems." If this doesn't do the count the way you want, post back.

for page in css:
        f = open(page, "r")
        lines = f.readlines()
        count = 1
        obcount = 0
        ebcount = 0
        scount = 0
        probwithfile = False
        for line in lines:
                count = line.count("{")
                obcount += count
                ebcount += line.count( "}" )
        print "total '{' = %d, and total '}' = %d" % (obcount, ebcount)
woooee 814 Nearly a Posting Maven

Add 2 other print statements to see what is happening. Note that the statement
x=[]
does nothing since you redefine x in the next statement.

n=range(0,31)
x=[]
for x in n:
   AL=5000.00
   MM=[]
   print "start of loop", MM
   MM_Income=12000.00
   MM_Cost=8000.00
   MM_Inc=800.00
   MM_Own=11
   MM_ROI=(MM_Income/(MM_Cost+(MM_Inc*x)+AL)*100)
   MM.append(MM_ROI)
   print "after appending", MM
   print (MM_ROI)
   MML=zip(n,MM)
   print (MML)
woooee 814 Nearly a Posting Maven

Yes that should have been one to get the next value. A good example of why we don't use "i".

vegaseat commented: good example +12
woooee 814 Nearly a Posting Maven

You want to stop at the next to last item in the list, so "+1" will be the last item. Also, do not use "i", "l", or "o" as single letter variable names. They look too much like numbers.

list1 = [4,20,2,19,3254,234,21,03]

stop = len(list1) - 1
low = list1[0]
for x in range(0, stop):
   if list1[x] < list1[x+i]:
       print x, list1[x], list1[x+1]
   if list1[x+1] < low:
      low = list1[x+1]
print "lowest =", low
woooee 814 Nearly a Posting Maven

If I understand what you want, you want to use
if ";" in line:
if not "X" in line:
etc.

woooee 814 Nearly a Posting Maven

You don't use the "i" from the for loop so "A" and "B" will always be the same for all 10 iterations through the loop. Also, try running this with these print statements added, which show that the two variables named "i" are different blocks of memory, and that "A" and "B" remain the same. It is bad practice to use "i", "l", or "o" as single letter variable names as they look like numbers.

import math

print "this program solves the prandtl equation by iteration"
rn = input("please input the reynolds number now: ")
f = -1
if rn<4000: 
      print "not a valid entry"
else:
      for i in range(1,11):
         print "for loop i =", i
         f = 0.054
         A = 1/math.sqrt(f)
         B = 2.0*math.log(rn*math.sqrt(f))-0.8
         print "A & B", A, B
         if A<B: 
            f = f-((f-0.008)/2)
            i = 0
            print "     other 'i' =", i
         elif B>A: 
            f= f+((0.1-f)/2)
            i = i+1
         else:
            break
      
print "the friction factor is",f

Also gastables from here https://launchpad.net/ubuntu/karmic/+source/gastables/0.2-2ubuntu1 will solve for Prandtl. You can use this program to check your results for correctness.

woooee 814 Nearly a Posting Maven

A google will yield a lot of hits. The python wiki is always a good place to start. http://wiki.python.org/moin/GuiProgramming

sneekula commented: good site +8
woooee 814 Nearly a Posting Maven

TypeError: String or Unicode type required

So this would probably work by converting to a string.

index = self.screen.InsertStringItem(sys.maxint, str(data[0]))
woooee 814 Nearly a Posting Maven
if row[i] == '':
			v = 0
                    else:
		        v= float(row[i])
                    self.csvData[i].append(v)

In this code, it could be the append statement that is taking the time since it is a large file. Store "i" and "v" in a dictionary until the end. After the loop is finished, instead of appending, it would probably be faster to loop through self.csvData, and append to a second list with the changes added. I don't know the internals of lists, but appending to the first list probably means that data has to be moved when something additional is inserted, which takes time. Writing to a second list, or file, just adds it on at the end. Also, using a dictionary would be even faster, or multiple lists with smaller amount of data per list. It would be simple to time this function, just two calls to datetime.datetime.now(), etc. to see if this is hanging the program.

As far as non-blocking goes, on Linux you can nice to a higher number (see man nice) which means it runs at a lower priority. Blocking would be more of an OS implementation, unless you are talking about blocking something in the same program.

Edit: What is self.csvData.append(v) and do you mean
self.csvData = v
and can you just write each line as it is encountered

for row in reader:
                for i in range(12):
                    output_row= []     ## empty list for each line
                    if row[i] == '':
			v = 0
                    else:
		        v= float(row[i])
                    output_row.append(v) …
woooee 814 Nearly a Posting Maven

[sarcastic] Damn, how many gigabytes is this code. Trim it down to one million lines of code so you don't have to zip it. [/sarcastic]

woooee 814 Nearly a Posting Maven

File "F:\My Projects\Python\PhoneBook.py\mainfile.pyw", line 79, in OnPopulate
index = self.screen.InsertStringItem(sys.maxint, data[0])

[(1, u'Steve', u'Giddy', u'0654743553'), (2, u'Majia', u'Ukonovic', u'65473032'), (3, u'Joseph', u'Ryanc', u'7663991109')]

If this list is "data" then data[0] is a tuple. If the first tuple is "data" then data[0] is an integer. Print data and type(data).

woooee 814 Nearly a Posting Maven

The above code doesn't strip the newline so you want to use .strip() as well. If the file contains multiple "geneX" codes, you want to append the records to a list until the next "gene" is found. When found, send the list to a function that will concatenate, similiar to the above code example (if you .strip() before appending to the list then you should be able to use the above code as is), and write to the SQL file. Then initialize the list to an empty list and start appending with the current "gene" record. After the loop that is reading the records finishes, you will have to add one more "send the final list to the function" line of code.

woooee 814 Nearly a Posting Maven

I think 'cut -d"_"' means split on the "_" which would be .split("_") in python but you will have to explain what the rest is. So first you want to post your code that opens the file and reads it one record at a time, and you should be able to split each rec as well after a quick trip to the docs. We can help you from there if we know what you want to do.

woooee 814 Nearly a Posting Maven

You can find an ordered dictionary here http://www.voidspace.org.uk/python/odict.html but that does not solve the "but then want _all_ messages with a higher ID" problem as you don't know what the next higher key is. A list of keys will return the index of the key found, and you can then increment through the end. Another way is to use an in memory SQLite database, lookup the key and then fetch until their are no more records
cur.execute(<SQL QUERY>)
cur.fetchone() # get one record
cur.fetchone() # get next record
If there is some reason why you can not do it either way then please post the reason, otherwise this thread should be considered solved.

woooee 814 Nearly a Posting Maven

When comparing two strings you want to make sure they are the same length. They will never be equal if they are different lengths, so add a statement which prints if they are not equal,

log_fp=open('log.txt','r')
read_log=log_fp.read()
while choice!=read_log:
    if len(choice) != len(read_log):
        print "choice length", choice, len(choice), \
                "and read_log length", read_log, len(read_log)
    choice=random.choice(combos)
print choice
woooee 814 Nearly a Posting Maven

I used:
if (queryperson in population):

Print the list "population" and see what it contains.

woooee 814 Nearly a Posting Maven


Membrane that surrounds the heart
a. somepossibleanswer
b. somepossibleanswer
c. somepossibleanswer
d. somepossibleanswer
e. correct answer
f. somepossibleanswer

> e

Correct!

One way is to use 2 dictionaries. The first uses "membrane" as the key, pointing to a list with the possible answers. You print/display this list in the form
a. somepossibleanswer
b. somepossibleanswer
c. somepossibleanswer
d. somepossibleanswer
e. correct answer
f. somepossibleanswer
The second dictionary would contain "membrane" as the key pointing to "e", the correct answer.

If it not too confusing, you could also use a dictionary pointing to a list of lists. The first list would contain the answers, and the second list would contain the correct answer. In any case, you want to store everything in containers so you can use one function to print and then check for the correct answer.

woooee 814 Nearly a Posting Maven

What can I do to prevent using same roll for two stats?

Append the random rolls to a list and use each value in the list once only. If I misunderstand and this is not what you want, then post back.

import random

## random can come up with the same number twice, so append
## integers until 6 unique numbers are in the list
def random_rolls():
   rolls_list = []
   ctr = 0
   while ctr < 6:
      x = random.randint(3,18)
      if x not in rolls_list:
         rolls_list.append(x)
         ctr += 1
   return rolls_list
         
#this will assign rollOne for strength stat
def chooseStrength(rolls_list):
   strengthChosen = raw_input("Choose a roll number between 1 and %d: " \
                               % (len(rolls_list)))

   ##  arrays are accessed via memory offset, so use 
   ##  zero through 5 instead of 1 --> 6 (one less)
   strengthChosen_int = int(strengthChosen) - 1
   strength = rolls_list[strengthChosen_int]
   print 'You have chosen the %s roll as your strength.Your strength is %d.' \
         % (strengthChosen, strength)

   ## now delete that number so it's not used again
   del rolls_list[strengthChosen_int]
   return strength, rolls_list

##-------------------------------------------------------------------
rolls_list = random_rolls()
print "You would use these numbers for the rolls:"
for x in rolls_list:
   print x
   
print "\nLet's do it again to test for different numbers"      
rolls_list = random_rolls()
print "You would use these numbers for the rolls:"
for x in rolls_list:
   print x

## copy the list if you want to keep the original
orig_rolls = rolls_list[:]

##  now chooseStrength as an example of how to use it
strength, rolls_list = …
woooee 814 Nearly a Posting Maven

Tkinter's FileDialog is a easy way to select a file name. Double click to select a directory or file.

from Tkinter import *
from FileDialog import FileDialog

def GetFilename( dir = "" ):
    top = Tk()

    d = FileDialog( top )
    fname = d.go( dir )
    if fname == None :
        print "No file found", fname
        fname = "****"
    else :
        print "The file is %s" % (fname)

    return fname

##================================================================
if __name__ == '__main__':
    ret_filename = GetFilename( "/home/")
    print "filename returned is %s" % (ret_filename)
woooee 814 Nearly a Posting Maven

The aorkeys extract correctly,

Assuming that this means that the list aorkeys contains all of the numbers that you want to find, and that it is not a huge list, it is easiest to look for each key in the list.

h = open(redFile,'w')
g = open(orgFile,'r')

#Search each entry in file.lst, if an entry is for a desired object
#add it to the output file

for rec in g:
   for key in aorkeys: 
      if key in rec:
         h.write("%s\n" % (key))
g.close()
h.close()

This is simplier, but potentially more time consuming than finding the number on each individual line and looking it up.

woooee 814 Nearly a Posting Maven

The standard solution for anagrams is to sort on the letters. So 'ogd' sorted is 'dgo', and a lookup of the 'dgo' key in the dictionary yields the list ["dog", "god"]. Your code would only return whichever one of these words it found first. Also, you should not use "dict" as a variable name as it is a reserved word. It is a good idea to use 2 words for a variable name to avoid possible conflicts. "words_dict" would be a better choice for example.

vegaseat commented: very good help +12
woooee 814 Nearly a Posting Maven

If possible, set it up so you can call/execute the C functions using subprocess. See "Reading from the output of a pipe:" here http://www.doughellmann.com/PyMOTW/subprocess/index.html#module-subprocess

woooee 814 Nearly a Posting Maven
This seems at odds with your analysis. Or am I missing something?

Python uses a list to store small numbers as that is more effecient so all small numbers point to the same object in the list which is why you get a True for a=1. The "is" operator though is for testing if it is the same object, and not equality. So
a=1
print a is 1
prints True because they both point to the same object. However, if you use a larger number, which is system dependent, but can be as small as 257, you will get a False for the same code. The point here is to use == for equality, as "is" will not give consisitent results. In fact, on my system I get different results with the same code run from the interactive prompt vs. running it in a .py file. From here http://docs.python.org/c-api/int.html

"The current implementation keeps an array of integer objects for all integers between -5 and 256, when you create an int in that range you actually just get back a reference to the existing object."

And for those who like to read http://svn.python.org/projects/python/trunk/Objects/intobject.c

"Integers are quite normal objects, to make object handling uniform.
(Using odd pointers to represent integers would save much space
but require extra checks for this special case throughout the code.)
Since a typical Python program spends much of its time allocating
and …

woooee 814 Nearly a Posting Maven

You maybe want "focus" or "geometry" depending on what you mean by "mouse position". You can find examples for both of them here http://infohost.nmt.edu/tcc/help/pubs/tkinter/

woooee 814 Nearly a Posting Maven

TypeError: sequence item 0: expected string, list found

It is very difficult to tell without knowing which line is causing the error. A guess would be this line
o.write('\n'.join(temp))
as you are tyring to join a list of lists [from the split()] instead of one list. Try this instead (there is no reason to append to a list and then write the list)

def columns(infile, outfile):
    f = open(infile,'r')
    o = open(outfile,'w')

    temp = []   #Store an empty list
    for line in f:
        line=line.strip()
        line_list=line.split('\t')
        line_list.insert(3, "1000")
##		temp.append(line)
#		print temp	 
	
        o.write(' '.join(line_list))
        o.write("\n")

    f.close()
    o.close()

Obviously, I do not have the input file, so can not test, but this is the general idea.

woooee 814 Nearly a Posting Maven

how can I achive mutliple matches from a line in single if statement like I need to ignore a line that starts with '<' and ends either with '>' or ' ; '

The simpliest way, without using and/or combinations, is to use an indicator which you set to True if found.

test_data = [ "keep this line>",
              "<ignore this line>",
              "<ignore this line also;" ]
              
ignore = False
for rec in test_data:
   rec = rec.strip()
   if rec.startswith("<"):
      if rec.endswith(">") or rec.endswith(";"):
         ignore = True
         
   if ignore:
      print "Ignore",
   else:
      print "OK",
   print rec
woooee 814 Nearly a Posting Maven

On click of a button on frm1, I want frm2 to pop up and frm1 to hide.

Use a normal function callback for the click on the button. The function will raise frm2 and/or lower frm1. How that is done depends on the toolkit you are using. Some sample code would help.

woooee 814 Nearly a Posting Maven

lsof will list all open files on the system and has many options for what is reported. See this page http://www.ibm.com/developerworks/aix/library/au-lsof.html

woooee 814 Nearly a Posting Maven

Use a list for the correct responses within some kind of while loop

exit = False
while not exit:
   #Limit the answer to a combination of r g b y o p
   colorCode = raw_input("Player 1 enter the secret code. No cheating player 2! ")
    if colorCode in ['r', 'g', 'b', 'y', 'o', 'p']:
       ## OK so ask next question
       #Limit the answer to numerical characters only. 
       # If not numerical, ask again.
       maxGuesses = raw_input("How many guesses do you want to give player 2? ")
       if maxGuesses.isdigit():
           H = Hints(int(maxGuesses), colorCode)   ## or whatever
           ##  exit loop
           exit = True
woooee 814 Nearly a Posting Maven

The outputs are excel based worksheets.

If reading an Excel sheet will solve the problem, pyExcelerator is one way http://sourceforge.net/projects/pyexcelerator

woooee 814 Nearly a Posting Maven

First, what happens if maxSignalInDatasource == 1000? I changed the first if to <= 1000. Second, int(offsetX) does nothing, so that was changed to offsetX_int = int(offsetX). Third, the way you have the indents positioned in your post, everything from
elif viewMaxSignal1 < 1000:
and below will only be executed if maxSignalInDatasource == 1000. The first pair of if/elif will catch everything else. You might consider using a function also instead of the redundant code, like the following.

def draw_line(multiplier_1, multiplier_2, displace_add, top_x, fill_x):
    offsetX = multiplier_1 * multipler_2
    offsetX += (displaceX + displace_add)
    offsetX_int = int(offsetX)
    draw.line((offsetX_int, top_x, offsetX_int, bottom), fill=fill_x)


if self.dataSource == "m_mas":
    if maxSignalInDatasource <= 1000:
        draw_line(maxSignalInDatasource, 0.029, 23, top1, '#cccccc'):
    else:   ## all other maxSignalInDatasource values (i.e. > 1000)
        draw_line(maxSignalInDatasource, 0.0029, 48, top2, '#cccccc'):

else self.dataSource == "m_rma":
    if maxSignalInDatasource < 18:
        ETC...