<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Matt,<div class=""><br class=""></div><div class=""> A Python dictionary is not ordered. So positions.keys() can return the values in any order and it can and does change order as more positions are added (because it is a hash map which reallocates as the size grows). So if you want them ordered then you order them yourself, for instance alphabetically:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>pnames = list(positions.keys())</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>pnames.sort()</div><div class=""><br class=""></div><div class=""> Tom</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 3, 2015, at 6:07 AM, Dougherty, Matthew T wrote:</div><br class="Apple-interchange-newline"><div class=""><div id="divtagdefaultwrapper" style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class="">Hi, <br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I have been automating the creation of positions using python scripts. Something relatively simple like p001, p002, etc.<br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">When I examine the positions using the python commands<br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">from Midas import positions<br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">pnames = positions.keys()<br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">at first things appear as I would expect, but later the sequence changes relative to the index, why is that?<br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">for example, using this to print the positions<br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div class=""></div><div class=""><div class=""> pnames = positions.keys()</div><div class=""> i=0</div><div class=""> for pname in pnames:</div><div class=""> print i,pnames[i]</div><div class=""> i=i+1<br class=""></div><br class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I get these results:<br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div class="">savepos p000</div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">savepos</span><span class="Apple-converted-space"> </span>p001<br class=""></div><div class="">0 p000</div><div class="">1 p001<br class=""></div><div class="">(as expected)<br class=""></div><div class=""><br class=""></div><div class=""></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">savepos</span><span class="Apple-converted-space"> </span>p002</div><div class="">0 p000<br class=""></div><div class="">1 p001</div><div class="">2 p002<br class=""></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">(as expected)</span><br class=""></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">savepos</span><span class="Apple-converted-space"> </span>p003</div><div class="">0 p000</div><div class="">1 p001</div><div class="">2 p002</div><div class="">3 p003<br class=""></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">(as expected)</span><br class=""></div><div class=""><br class=""></div><div class=""></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">savepos</span><span class="Apple-converted-space"> </span>p004</div><div class="">0 p004</div><div class="">1 p000</div><div class="">2 p001</div><div class="">3 p002</div><div class="">4 p003<br class=""></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">(not as expected)</span><br class=""></div><div class=""><br class=""></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class=""></span></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">savepos</span><span class="Apple-converted-space"> </span>p005</div><div class="">0 p004</div><div class="">1 p005</div><div class="">2 p000</div><div class="">3 p001</div><div class="">4 p002</div><div class="">5 p003<br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">(not as expected)</span><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">I would expect pnames[0] to correspond to the first position created, pnames[1] to the second posiiton created, etc., assuming no ~savepos used. </span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Want to create a situation where the default names would be pxxx, but could later be altered to more meaningful names but maintain the order of creation, or getting a session file from someone I would use their position names and tack on my default names to the end of the position list.</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div id="Signature" class=""><div class="BodyFragment"><font size="2" class=""><div class="PlainText">Matthew Dougherty<br class="">National Center for Macromolecular Imaging<br class="">Baylor College of Medicine<br class="">===========================================================================</div></font></div></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Chimera-users mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:Chimera-users@cgl.ucsf.edu" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Chimera-users@cgl.ucsf.edu</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a></div></blockquote></div><br class=""></div></body></html>