[Chimera-users] resampling maps
Jason Kaelber
jtk52 at cornell.edu
Wed Apr 2 23:30:50 PDT 2014
Just in case anybody else has a similar question and finds this thread in
the mailing list archives, I wanted to follow up:
I tried your suggestion of vop scale #0 value float32. Unfortunately this
makes the map lose its orientation.
But, your explanation told me that if I convert the map to 32-bit, it will
resample OK. Therefore, I
-saved the open session where I oriented all my models,
-made a temp directory and moved all the models into it,
-generated float32 version of the map with the same name, e.g. e2proc3d.py
./temp/model.mrc ./model.mrc
-and reopened the Chimera session. Then I can resample and save all the
maps!
Tom, thanks a lot for helping me figure this out and also for fixing the
bug in the new version.
Sincerely,
Jason
On Wed, Apr 2, 2014 at 6:10 PM, Tom Goddard <goddard at sonic.net> wrote:
> Hi Jason,
>
> 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).
>
> So I fixed the bug in tonight's Chimera daily build to cast the float
> values to the integer type of the original map.
>
> 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
>
> vop scale #0 value float32
>
> That will produce a new map (called #1) that has 32-bit float value and
> that can be resampled without errors in your Chimera.
>
> Thanks for reporting this bug. I'm surprised it was not reported
> earlier.
>
> Tom
>
>
> On Apr 1, 2014, at 10:20 PM, Jason Kaelber wrote:
>
> > Hi all,
> >
> > 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,
> > TypeError: Cannot cast ufunc add output from dtype('float32') to
> dtype('uint8') with casting rule 'same_kind'
> >
> > 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.
> >
> > Thanks,
> > Jason
> >
> >
> >
> >
> >
> >
> > <type 'exceptions.TypeError'> Exception in Tk callback
> > Function: <bound method MidasUI.processCommand of
> <Midas.midas_ui.MidasUI instance at 0x276b2d88>> (type: <type
> 'instancemethod'>)
> > Args: (<Tkinter.Event instance at 0x276a2ea8>,)
> > Event type: KeyPress (type num: 2)
> > Traceback (innermost last):
> > File
> "/opt/UCSF/Chimera64-1.8.1/lib/python2.7/site-packages/Pmw/Pmw_1_3/lib/PmwBase.py",
> line 1747, in __call__
> > return apply(self.func, args)
> > File "/opt/UCSF/Chimera64-1.8.1/share/Midas/midas_ui.py", line 283, in
> processCommand
> > midas_text.makeCommand(cmdText)
> > File "/opt/UCSF/Chimera64-1.8.1/share/Midas/midas_text.py", line 69,
> in makeCommand
> > f(c, args)
> > File
> "/opt/UCSF/Chimera64-1.8.1/share/VolumeFilter/ChimeraExtension.py", line
> 24, in vop_cmd
> > vop_command(cmdname, args)
> > File "/opt/UCSF/Chimera64-1.8.1/share/VolumeFilter/vopcommand.py",
> line 91, in vop_command
> > doExtensionFunc(func, fargs, specInfo = spec)
> > File "/opt/UCSF/Chimera64-1.8.1/share/Midas/midas_text.py", line 435,
> in doExtensionFunc
> > extFunc(*tuple(processedArgs), **kw)
> > File "/opt/UCSF/Chimera64-1.8.1/share/VolumeFilter/vopcommand.py",
> line 553, in resample_op
> > boundingGrid, False, None, modelId)
> > File "/opt/UCSF/Chimera64-1.8.1/share/VolumeFilter/vopcommand.py",
> line 168, in add_operation
> > scale = scale[i])
> > File "/opt/UCSF/Chimera64-1.8.1/share/VolumeViewer/volume.py", line
> 1535, in add_interpolated_values
> > m[:,:,:] += values
> > <type 'exceptions.TypeError'>: Cannot cast ufunc add output from
> dtype('float32') to dtype('uint8') with casting rule 'same_kind'
> >
> > ================================================
> > Event contents:
> > char:
> > delta: 36
> > height: ??
> > keycode: 36
> > keysym: Return
> > keysym_num: 65293
> > num: ??
> > send_event: False
> > serial: 39103
> > state: 16
> > time: 139539396
> > type: 2
> > widget: .59791048.661335648.802317088.802317376.802317448
> > width: ??
> > x: 159
> > x_root: 524
> > y: 9
> > y_root: 988
> >
> > TypeError: Cannot cast ufunc add output from dtype('float32') to
> dtype('uint8') with casting rule 'same_kind'
> >
> > File "/opt/UCSF/Chimera64-1.8.1/share/VolumeViewer/volume.py", line
> 1535, in add_interpolated_values
> > m[:,:,:] += values
> >
> > See reply log for Python traceback.
> > --
> > National Center for Macromolecular Imaging, N420
> > Baylor College of Medicine, MS BCM125
> > 1 Baylor Plaza
> > Houston, TX, USA
> > _______________________________________________
> > Chimera-users mailing list
> > Chimera-users at cgl.ucsf.edu
> > http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
>
>
--
National Center for Macromolecular Imaging, N420
Baylor College of Medicine, MS BCM125
1 Baylor Plaza
Houston, TX, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20140403/c88e400a/attachment.html>
More information about the Chimera-users
mailing list