16. Combine with “your” Code

This is python: Add your own logic!

Here: Let’s display the approximate SEDs and let the user interactively select “interesting” cases.

 for pos, phots in seds:
    to_plot = np.array(phots)
    plt.semilogx(to_plot[:,0], to_plot[:,1], '-')
    plt.show(block=False)
    selection = raw_input(
      "s)elect SED, q)uit, enter for next? ")
    if selection=="q":
      break
    if selection=="s":
      selected.append(pos)
    plt.cla()
  return selected

[See fetch3_cluster.py]

This is now fairly standard matplotlib. We’re interacting through raw_input in the shell here for simplicity. It’s not actually hard to interact through the matlotlib window, but that requires a bit object magic that we wanted to avoid here.

Problems

(1)

Go through the source code of fetch3_cluster. You’ll see we’ve put in two workarounds for where the data providers messed up. Can you see in each case what might have gone wrong? Have the service operators fixed their software or do things still fail when you remove a workaround? In a course setting, coordinate with your neighbours and split up the work so each only looks at one workaround.

(2)

Run the program and select a couple of objects. Keep the resulting file (selected_positions.vot) – we’ll want to reuse it later.

Files


Markus Demleitner, Hendrik Heinl