import ensight import numpy varname = "Displacement" # how many querys so far num = ensight.query(ensight.QUERY_COUNT)[1][0] # add a query a = ensight.query(ensight.TIMEVALS) ensight.part.select_all() ensight.variables.activate(varname) ensight.part.select_all() ensight.query_ent_var.begin() ensight.query_ent_var.description("") ensight.query_ent_var.query_type("generated") ensight.query_ent_var.number_of_sample_pts(len(a['timevalues'])) ensight.query_ent_var.begin_simtime(a['timelimits'][0]) ensight.query_ent_var.end_simtime(a['timelimits'][1]) ensight.query_ent_var.constrain("max") ensight.query_ent_var.sample_by("value") ensight.query_ent_var.variable_1(varname) ensight.query_ent_var.generate_over("time") ensight.query_ent_var.variable_2("TIME") ensight.query_ent_var.end() ensight.query_ent_var.query() # get the query data data = ensight.query(ensight.QUERY_DATA,num) # extract the x,y values v = numpy.array(data[2],numpy.float32) # reform into array of [n,2] v.shape = (len(v)/2,2) # compute the maximum value maxval = v[:,1].max() # print value back to the Python Command Window print "The maximum query value of ",varname, " is:", maxval