<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; ">Hi Jason,<div><br></div><div> Ugh. Sorry Chimera is causing you so many troubles. That "vop scale" is not aligning the new volume with the one you scaled is a bug. I've fixed that in tonight's daily build. The trouble was that the code forgot to set the the position of the new scaled map to match the original map. So it used Chimera's default rule when creating a new map or molecule which is to align it with the currently open model which has the lowest id number (e.g. id #0). Apparently in your session that lowest id model was moved relative to the map you were scaling so its positioning transform was different. This is fixed so the new scaled map will always align with the original map. To work around this in your current Chimera after you do "vop scale #5 value float32" and it creates the new scaled map as say #6 (if that is the next available id number), then you can fix its alignment with "matrixcopy #5 #6".</div><div><br></div><div> I hope you don't find more bugs, but if you do, tell me and I will fix them.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Tom</div><div><br></div><div><br></div><div><div><div>On Apr 2, 2014, at 11:30 PM, Jason Kaelber <<a href="mailto:jtk52@cornell.edu">jtk52@cornell.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div style="">Just in case anybody else has a similar question and finds this thread in the mailing list archives, I wanted to follow up:</div><div><br></div><div>I tried your suggestion of vop scale #0 value float32. Unfortunately this makes the map lose its orientation.</div>
<div><br></div><div>But, your explanation told me that if I convert the map to 32-bit, it will resample OK. Therefore, I<br></div><div style="">-saved the open session where I oriented all my models,</div><div style="">-made a temp directory and moved all the models into it,</div>
<div style="">-generated float32 version of the map with the same name, e.g. e2proc3d.py ./temp/model.mrc ./model.mrc</div><div style="">-and reopened the Chimera session. Then I can resample and save all the maps!</div><div style="">
<br></div><div style="">Tom, thanks a lot for helping me figure this out and also for fixing the bug in the new version.</div><div style="">Sincerely,</div><div style="">Jason</div><div style=""><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Apr 2, 2014 at 6:10 PM, Tom Goddard <span dir="ltr"><<a href="mailto:goddard@sonic.net" target="_blank">goddard@sonic.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Jason,<br>
<br>
This is a Chimera bug. Resampling a map with integer values on a new grid produces 32-bit floating point values because it uses trilinear interpolation. But the Chimera code makes the new resampled map have integer values of the same type as the input map, and converting the float values to integer is generating this error (I think because the Python numpy module changed at some point to not automatically cast float to integer).<br>
<br>
So I fixed the bug in tonight's Chimera daily build to cast the float values to the integer type of the original map.<br>
<br>
You can also avoid the error with the Chimera 1.8.1 that you are using by first converting your map to 32-bit float values using Chimera command<br>
<br>
vop scale #0 value float32<br>
<br>
That will produce a new map (called #1) that has 32-bit float value and that can be resampled without errors in your Chimera.<br>
<br>
Thanks for reporting this bug. I'm surprised it was not reported earlier.<br>
<br>
Tom<br>
<div><div class="h5"><br>
<br>
On Apr 1, 2014, at 10:20 PM, Jason Kaelber wrote:<br>
<br>
> Hi all,<br>
><br>
> I decided to do a rough alignment of density maps manually and resample onto a common coordinate system to feed the output mrc files into my fine aligner. But, when I vop resample #1 onGrid #0, I get,<br>
> TypeError: Cannot cast ufunc add output from dtype('float32') to dtype('uint8') with casting rule 'same_kind'<br>
><br>
> What might I be doing wrong to get this error? As far as I know, all the maps should be uint8 since they were most recently operated on by David Mastronarde's newstack command which outputs them as unsigned bytes.<br>
><br>
> Thanks,<br>
> Jason<br>
><br>
><br>
><br>
><br>
><br>
><br>
> <type 'exceptions.TypeError'> Exception in Tk callback<br>
> Function: <bound method MidasUI.processCommand of <Midas.midas_ui.MidasUI instance at 0x276b2d88>> (type: <type 'instancemethod'>)<br>
> Args: (<Tkinter.Event instance at 0x276a2ea8>,)<br>
> Event type: KeyPress (type num: 2)<br>
> Traceback (innermost last):<br>
> File "/opt/UCSF/Chimera64-1.8.1/lib/python2.7/site-packages/Pmw/Pmw_1_3/lib/PmwBase.py", line 1747, in __call__<br>
> return apply(self.func, args)<br>
> File "/opt/UCSF/Chimera64-1.8.1/share/Midas/midas_ui.py", line 283, in processCommand<br>
> midas_text.makeCommand(cmdText)<br>
> File "/opt/UCSF/Chimera64-1.8.1/share/Midas/midas_text.py", line 69, in makeCommand<br>
> f(c, args)<br>
> File "/opt/UCSF/Chimera64-1.8.1/share/VolumeFilter/ChimeraExtension.py", line 24, in vop_cmd<br>
> vop_command(cmdname, args)<br>
> File "/opt/UCSF/Chimera64-1.8.1/share/VolumeFilter/vopcommand.py", line 91, in vop_command<br>
> doExtensionFunc(func, fargs, specInfo = spec)<br>
> File "/opt/UCSF/Chimera64-1.8.1/share/Midas/midas_text.py", line 435, in doExtensionFunc<br>
> extFunc(*tuple(processedArgs), **kw)<br>
> File "/opt/UCSF/Chimera64-1.8.1/share/VolumeFilter/vopcommand.py", line 553, in resample_op<br>
> boundingGrid, False, None, modelId)<br>
> File "/opt/UCSF/Chimera64-1.8.1/share/VolumeFilter/vopcommand.py", line 168, in add_operation<br>
> scale = scale[i])<br>
> File "/opt/UCSF/Chimera64-1.8.1/share/VolumeViewer/volume.py", line 1535, in add_interpolated_values<br>
> m[:,:,:] += values<br>
> <type 'exceptions.TypeError'>: Cannot cast ufunc add output from dtype('float32') to dtype('uint8') with casting rule 'same_kind'<br>
><br>
> ================================================<br>
> Event contents:<br>
> char:<br>
> delta: 36<br>
> height: ??<br>
> keycode: 36<br>
> keysym: Return<br>
> keysym_num: 65293<br>
> num: ??<br>
> send_event: False<br>
> serial: 39103<br>
> state: 16<br>
> time: 139539396<br>
> type: 2<br>
> widget: .59791048.661335648.802317088.802317376.802317448<br>
> width: ??<br>
> x: 159<br>
> x_root: 524<br>
> y: 9<br>
> y_root: 988<br>
><br>
> TypeError: Cannot cast ufunc add output from dtype('float32') to dtype('uint8') with casting rule 'same_kind'<br>
><br>
> File "/opt/UCSF/Chimera64-1.8.1/share/VolumeViewer/volume.py", line 1535, in add_interpolated_values<br>
> m[:,:,:] += values<br>
><br>
> See reply log for Python traceback.<br>
> --<br>
> National Center for Macromolecular Imaging, N420<br>
> Baylor College of Medicine, MS BCM125<br>
> 1 Baylor Plaza<br>
> Houston, TX, USA<br>
</div></div>> _______________________________________________<br>
> Chimera-users mailing list<br>
> <a href="mailto:Chimera-users@cgl.ucsf.edu">Chimera-users@cgl.ucsf.edu</a><br>
> <a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" target="_blank">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">National Center for Macromolecular Imaging, N420<div>Baylor College of Medicine, MS BCM125</div><div>1 Baylor Plaza</div><div>Houston, TX, USA</div>
</div>
</div>
_______________________________________________<br>Chimera-users mailing list<br><a href="mailto:Chimera-users@cgl.ucsf.edu">Chimera-users@cgl.ucsf.edu</a><br>http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users<br></blockquote></div><br></div></body></html>