Disordered CTF and pose in write_star.py
Following issue #130 as I just typing python ~/Softwares/cryodrgn/cryodrgn/commands_utils/write_star.py particles.128.txt ctf.pkl --poses pose.pkl -o test2.star --ref-star ../2star.star --keep-micrograph (ind argument removed for simplifying the issue ) to build the .star file from my selected images, the 2D classification of the images turned out to be like this

.star file built by write_star.py
_rlnImageName
_rlnDefocusU
_rlnDefocusV
_rlnDefocusAngle
_rlnVoltage
_rlnSphericalAberration
_rlnAmplitudeContrast
_rlnPhaseShift
_rlnAngleRot
_rlnAngleTilt
_rlnAnglePsi
_rlnOriginX
_rlnOriginY
_rlnMicrographName
_rlnCoordinateX
_rlnCoordinateY
1@/data/xieyufeng/PQ1_DNA/P29/particles.128.0.mrcs 11141.097 10912.431 82.81079 300.0 2.9867246 0.1 -1.9220387 88.48406973608894 125.24576460520314 -174.39387210967334 -0.5 0.060000002 J1/imported/000006424979704304601_FoilHole_22853959_Data_22837308_22837310_20220722_231734_fractions_Sumcorr2_DW.mrc 3678 1726
.star file built by csparc2star.py (which led to good 2D classification, not shown in this issue)
_rlnImageName #1
_rlnMicrographName #2
_rlnCoordinateX #3
_rlnCoordinateY #4
_rlnAngleRot #5
_rlnAngleTilt #6
_rlnAnglePsi #7
_rlnOriginXAngst #8
_rlnOriginYAngst #9
_rlnDefocusU #10
_rlnDefocusV #11
_rlnDefocusAngle #12
_rlnPhaseShift #13
_rlnCtfBfactor #14
_rlnOpticsGroup #15
_rlnRandomSubset #16
_rlnClassNumber #17
000001@J10/extract/000006424979704304601_FoilHole_22853959_Data_22837308_22837310_20220722_231734_fractions_Sumcorr2_DW_particles.mrcs J1/imported/000006424979704304601_FoilHole_22853959_Data_22837308_22837310_20220722_231734_fractions_Sumcorr2_DW.mrc 3678 1726 59.957691 106.849068 -63.732594 0.637500 -1.572500 13914.549805 13641.956055 75.117569 -1.922039 0.000000 13 2 1
I noticed that the _rlnMicrographName _rlnCoordinateX _rlnCoordinateY matched well but pose and CTF didn't...
this is derived from unmatched order between .cs file and .star file and I noticed the path uid of image[0] in .cs is 000006424979704304601 while it's 000006424979704304601 in .star (.cs is the original particle meta file and .star is built by csparc2star.py for this write_starfile.py command)
In [9]: particle_dataset.data
Out[9]:
Data([('uid',
array([ 2804416109571326369, 14839775611369469847, 4077396580618745039,
..., 2525129479159458673, 2238403284433121189,
6237294877584932823], dtype=uint64)),
('blob/path',
array(['J10/extract/006396836222319133855_FoilHole_22840839_Data_22837308_22837310_20220722_185034_fractions_Sumcorr2_DW_particles.mrc',
'J10/extract/006396836222319133855_FoilHole_22840839_Data_22837308_22837310_20220722_185034_fractions_Sumcorr2_DW_particles.mrc',
'J10/extract/006396836222319133855_FoilHole_22840839_Data_22837308_22837310_20220722_185034_fractions_Sumcorr2_DW_particles.mrc',
...,
so in command python write_star.py particles.128.txt ctf.pkl --poses pose.pkl -o test2.star --ref-star ../2star.star --keep-micrograph, I should check --ref-star carefully and extra argument like --ref-cs is needed...
I guess extra argument --ref-cs could be omitted, for the disordered --ref-star is derived from csparc2star.py
two command
csparc2star.py P29_J19_passthrough_particles.cs test.star --swapxy
csparc2star.py cryosparc_P29_J19_006_particles.cs P29_J19_passthrough_particles.cs 2star.star --swapxy
brought unmatched order of images and just commenting out two lines of codes in pyem/pyem/star.py/write_star() worked
