nano-bio / IsotopeFitSharp

0 stars 0 forks source link

Provide List of Cluster IDs currently loaded in the workspace #3

Closed johannespostler closed 6 years ago

johannespostler commented 6 years ago

When going through several operations, dictionaries for the GUI are sometimes needed such as this one:

{'1H1': array([[ 1.00782503, 0.999885 ]]), '1He1': array([[ 4.00260325, 0.99999866]])}

To create these dictionaries on demand, a loop in Python is required which could look like this:


newlist = {}
for cluster_id in gui.clusterIdList:
     mass = to_ndarray(self.wrk.Clusters[cluster_id].PeakData.Mass)
     abundance = to_ndarray(self.wrk.Clusters[cluster_id].PeakData.Abundance)
     newlist[cluster_id] = np.concatenate((mass, abundance), axis=0)

This currently uses gui.clusterIdList, which was generated at load time of the matlab file and kept by the GUI. However, this belongs to the library. It should provide a list that a Python for statement can loop over.