Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > Python

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-26-2009, 04:32 PM   PM User | #1
roro
New to the CF scene

 
Join Date: Apr 2009
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
roro is an unknown quantity at this point
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 0-1000
			# 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 1000-10000
			# 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 0-1000
			# 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 1000-10000
			# 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 0-1000
				# 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 1000-10000
				# 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 0-1000
			# 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 1000-10000
			# 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 0-1000
			# 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 1000-10000
			# 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 0-1000
				# 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 1000-10000
				# 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)
roro is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:35 AM.


Advertisement
Log in to turn off these ads.