Hey guys,
I’m using a handler to take a list of records, make come calculations using the data in each record, and then append the results from the calculations to each record in the list.
I have the handler built, and it works perfectly for small lists, but stops working with larger lists or records. When it stops working, it doesn’t seem to be stuck in a loop or anything (which would make it get stuck in all cases), because the cpu goes to 0% and there is simply no activity.
The culprit must be that I’m using the Satimage scripting addition to provide three functions: inverse tangent, absolute value, and a simple sort. I can do the sort and absolute value functions without the addition, but the inverses tangent is another problem.
Anyways, here’s the handler and a call for it. If you shrink down the (simplified) list of records to five or so (sometimes more) then it works fine, but if you copy the list of records over and over again to make it bigger, like over 20, then the handler hangs with no activity. At the bottom of the post is a record from the list as I’m actually using it (which was made using this exact handler)
On a side note, I originally found this problem when I had these calculations being performed inside the handler I use to fetch data and make the list of records, but the problem persists when it happened afterwards as a separate handler, and this way is easier for pleading to the community.
ALMOST FORGOT, here’s a link to the scripting addition I’m using: http://www.satimage.fr/software/downloads/Satimage374.pkg
Thanks,
Tim
on directionality(cpInfo)
set outputList to {}
repeat with CP in cpInfo
set eigenvalues to eigenvalues of CP
set eigenvalues to sortlist (eigenvalues)
set theta to (atan ((abs ((item 3 of eigenvalues) / (item 2 of eigenvalues))) ^ (1 / 2)))
set phi to (atan ((abs ((item 3 of eigenvalues) / (item 1 of eigenvalues))) ^ (1 / 2)))
set end of outputList to CP & {theta:theta, phi:phi}
end repeat
return outputList
end directionality
return directionality({{eigenvalues:{-0.9597067, -0.8515133, 1.037286}}, {eigenvalues:{-0.6967747, -0.663849, 0.4989427}}, {eigenvalues:{-0.7110512, -0.6271766, 0.4827656}}, {eigenvalues:{-0.006542409, -0.003578518, 0.04239628}}, {eigenvalues:{-0.008725163, -0.006836066, 0.05433055}}, {eigenvalues:{-0.006010937, -0.002223808, 0.03224129}}, {eigenvalues:{-0.001855394, -0.001145129, 0.01483521}}, {eigenvalues:{-0.03390511, -0.03304477, 0.1504457}}, {eigenvalues:{-0.03119456, -0.02933444, 0.1415584}}, {eigenvalues:{-0.003994763, -0.003015927, 0.02664459}}, {eigenvalues:{-0.003536827, -0.003140148, 0.0272672}}, {eigenvalues:{-0.003078962, -4.091325E-4, 0.02010834}}, {eigenvalues:{-0.05565543, -0.05536525, 0.1782501}}})
{CP:"307", rankSignature:"(3,-1)", del:"-0.7739336E+00", rho:"0.4056540E+00", eigenvalues:{-0.9597067, -0.8515133, 1.037286}, theta:0.834655257394, phi:0.804827084365}
Model: MBP-r
AppleScript: 2.2.2
Browser: Safari 536.25
Operating System: Mac OS X (10.8)