Enjoy an ad free experience by logging in. Not a member yet? Register.

Results 1 to 1 of 1
Thread: Python decision making code

05262009, 05:32 PM #1
 Join Date
 Apr 2009
 Posts
 9
 Thanks
 1
 Thanked 0 Times in 0 Posts
Python decision making code
I am trying to make the code below make decisions between two different data sources. Basically, if the data source is m_mas it should go through one set of processes, and if it is m_rma, the coding should go through another set of processes.
I am not sure if I am using the decision making syntax correctly and would appreciate any help. Thanks.
Code:if self.dataSource == "m_mas": if maxSignalInDatasource < 1000: # the little graph on the tga image has a scale # such that 1 unit is 0.031 pixels for the range 01000 # Also it is displaced to the right by some pixels offsetX = maxSignalInDatasource*0.029 offsetX += (displaceX + 23) int(offsetX) draw.line((offsetX, top1, offsetX, bottom), fill='#cccccc') elif maxSignalInDatasource > 1000: # the little graph on the tga image has a scale # such that 1 unit is 0.003222 pixels for the range 100010000 # This bit of the graph is displaced another 31 pixels offsetX = maxSignalInDatasource*0.0029 offsetX += (displaceX + 48) int(offsetX) draw.line((offsetX, top2, offsetX, bottom), fill='#cccccc') elif viewMaxSignal1 < 1000: # the little graph on the tga image has a scale # such that 1 unit is 0.031 pixels for the range 01000 # Also it is displaced to the right by some pixels offsetX = viewMaxSignal1*0.029 offsetX += (displaceX + 23) int(offsetX) draw.line((offsetX, top1, offsetX, bottom), fill=red) elif viewMaxSignal1 > 1000: # the little graph on the tga image has a scale # such that 1 unit is 0.003222 pixels for the range 100010000 # This bit of the graph is displaced another 31 pixels offsetX = viewMaxSignal1*0.0029 offsetX += (displaceX + 48) int(offsetX) draw.line((offsetX, top2, offsetX, bottom), fill=red) elif mode == 'Compare': if viewMaxSignal2 < 1000: # the little graph on the tga image has a scale # such that 1 unit is 0.031 pixels for the range 01000 # Also it is displaced to the right by some pixels offsetX = viewMaxSignal2*.0029 offsetX += (displaceX + 29) int(offsetX) draw.line((offsetX, top1, offsetX, bottom), fill=blue) elif viewMaxSignal2 > 1000: # the little graph on the tga image has a scale # such that 1 unit is 0.003222 pixels for the range 100010000 # This bit of the graph is displaced another 31 pixels offsetX = viewMaxSignal2*0.003222 offsetX += (displaceX + 37) int(offsetX) draw.line((offsetX, top2, offsetX, bottom), fill=blue) else self.dataSource == "m_rma": if maxSignalInDatasource < 18: # the little graph on the tga image has a scale # such that 1 unit is 0.031 pixels for the range 01000 # Also it is displaced to the right by some pixels offsetX = maxSignalInDatasource*0.004 offsetX += (displaceX + 12) int(offsetX) draw.line((offsetX, top1, offsetX, bottom), fill='#cccccc') #if maxSignalInDatasource > 1000: # the little graph on the tga image has a scale # such that 1 unit is 0.003222 pixels for the range 100010000 # This bit of the graph is displaced another 31 pixels #offsetX = maxSignalInDatasource*0.0029 #offsetX += (displaceX + 48) #int(offsetX) #draw.line((offsetX, top2, offsetX, bottom), fill='#cccccc') if viewMaxSignal1 < 18: # the little graph on the tga image has a scale # such that 1 unit is 0.031 pixels for the range 01000 # Also it is displaced to the right by some pixels offsetX = viewMaxSignal1*0.004 offsetX += (displaceX + 12) int(offsetX) draw.line((offsetX, top1, offsetX, bottom), fill=red) #if viewMaxSignal1 > 1000: # the little graph on the tga image has a scale # such that 1 unit is 0.003222 pixels for the range 100010000 # This bit of the graph is displaced another 31 pixels #offsetX = viewMaxSignal1*0.0029 #offsetX += (displaceX + 48) #int(offsetX) #draw.line((offsetX, top2, offsetX, bottom), fill=red)) if mode == 'Compare': if viewMaxSignal2 < 18: # the little graph on the tga image has a scale # such that 1 unit is 0.031 pixels for the range 01000 # Also it is displaced to the right by some pixels offsetX = viewMaxSignal2*.004 offsetX += (displaceX + 28) int(offsetX) draw.line((offsetX, top1, offsetX, bottom), fill=blue) #if viewMaxSignal2 > 1000: # the little graph on the tga image has a scale # such that 1 unit is 0.003222 pixels for the range 100010000 # This bit of the graph is displaced another 31 pixels #offsetX = viewMaxSignal2*0.003222 #offsetX += (displaceX + 37) #int(offsetX) #draw.line((offsetX, top2, offsetX, bottom), fill=blue)