roro

05-26-2009, 05:32 PM

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.

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)

I am not sure if I am using the decision making syntax correctly and would appreciate any help. Thanks.

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)