cctbx_project icon indicating copy to clipboard operation
cctbx_project copied to clipboard

Bare print statement in xfel/clustering/cluster_groups.py

Open jbeilstenedmands opened this issue 2 years ago • 1 comments

In the unit_cell_info function in cluster_groups.py, text output is collated into an output string, except in one instance, where print is called: https://github.com/cctbx/cctbx_project/blob/84778b7104931a7c905c90744cb310c7dad9d06f/xfel/clustering/cluster_groups.py#L35 This becomes an issue when trying to control text output, as one can not selectively suppress this output. As this is printing information that is also added to the output string, it could be the case that this is just leftover redundancy after a few code updates. I would like to either a) remove the print statement entirely, or b) add this information to the start of the output string. I wondered if @phyy-nx has any thoughts? My preference would be for a). I'm happy to do the work for this.

Currently, if you then immediately print the output string, as is typically the case in the code, this gives the following kind of output:

                       Unit cell: (96.7358, 96.7358, 96.7358, 90, 90, 90)
                       Unit cell: (136.846, 136.846, 96.6817, 90, 90, 90)
                       Unit cell: (96.7108, 96.7108, 193.541, 90, 90, 90)

0 singletons:

Point group    a           b           c          alpha        beta         gamma       

3 clusters:

Cluster_id       N_xtals  Med_a         Med_b         Med_c         Med_alpha    Med_beta     Med_gamma   Delta(deg)
34 in P1.
cluster_23       34       96.51 (0.17 ) 96.69 (0.09 ) 97.01 (0.31 ) 89.95 (0.31) 89.97 (0.31) 89.96 (0.17)
      P m -3 m (No. 221)  96.74         96.74         96.74         90.00        90.00        90.00         0.3   

5 in P1.
cluster_22       5        96.68 (0.32 ) 136.62(0.16 ) 137.08(0.31 ) 90.12 (0.24) 90.05 (0.17) 90.07 (0.40)
     P 4/m m m (No. 123)  136.85        136.85        96.68         90.00        90.00        90.00         0.21  

4 in P1.
cluster_21       4        96.50 (0.06 ) 96.92 (0.36 ) 193.54(0.55 ) 89.97 (0.27) 89.92 (0.33) 89.99 (0.27)
     P 4/m m m (No. 123)  96.71         96.71         193.54        90.00        90.00        90.00         0.26  

Removing the print would remove the three lines of unit cells at the start.

jbeilstenedmands avatar Mar 02 '22 13:03 jbeilstenedmands

Hi @jbeilstenedmands, no issues from me if you remove that print statement.

phyy-nx avatar Mar 03 '22 19:03 phyy-nx