Jarrod Millman | 1 Oct 01:14
Picon
Favicon
Gravatar

Re: Nifti support

On 9/30/07, Matthieu Brucher <matthieu.brucher <at> gmail.com> wrote:
> I saw that nifti file support was currently in the pipeline. If the license
> issue is solved, I can provide you a nifticlib.i file that is compatible
> with C89 compilers (the converted file needs a C99 compiler, so compiling it
> with MSVC is not possible), as I've done this for my hobbies some weeks ago.

Hey Matthieu,

The pynifti license issue has been resolved.  Michael Hanke, the
author, has released his software under an MIT license:
http://sourceforge.net/project/shownotes.php?group_id=126549&release_id=543252

Early this week, Chris Burns and I will check this code into the SciPy
repository.  Once we do, it would be great if you could either
integrate your nifticlib.i into the codebase or just send us your
code.

Thanks,

--

-- 
Jarrod Millman
Computational Infrastructure for Research Labs
10 Giannini Hall, UC Berkeley
phone: 510.643.4014
http://cirl.berkeley.edu/
Matthieu Brucher | 1 Oct 07:20
Picon

Re: Nifti support

Excellent news !!

Matthieu

2007/10/1, Jarrod Millman <millman <at> berkeley.edu>:
On 9/30/07, Matthieu Brucher <matthieu.brucher <at> gmail.com> wrote:
> I saw that nifti file support was currently in the pipeline. If the license
> issue is solved, I can provide you a nifticlib.i file that is compatible
> with C89 compilers (the converted file needs a C99 compiler, so compiling it
> with MSVC is not possible), as I've done this for my hobbies some weeks ago.

Hey Matthieu,

The pynifti license issue has been resolved.  Michael Hanke, the
author, has released his software under an MIT license:
http://sourceforge.net/project/shownotes.php?group_id=126549&release_id=543252

Early this week, Chris Burns and I will check this code into the SciPy
repository.  Once we do, it would be great if you could either
integrate your nifticlib.i into the codebase or just send us your
code.

Thanks,

--
Jarrod Millman
Computational Infrastructure for Research Labs
10 Giannini Hall, UC Berkeley
phone: 510.643.4014
http://cirl.berkeley.edu/
_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev

_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev
Jarrod Millman | 2 Oct 19:24
Picon
Favicon
Gravatar

adopting Python Style Guide for classes

Hello,

For those of you not on the Numpy developer's list, we have been
talking about adopting the Python class naming convention to conform
with Guido's style guide as closely as possible:
http://www.python.org/dev/peps/pep-0008/
According to Guido,  class names should use the CapWords convention.
Most Python projects (eg, ETS, matploltlib) adhere to the Python
naming conventions and it is confusing that NumPy and SciPy don't.

Currently, both NumPy and SciPy use either lower_underscore_separated
or CapWords for class names.

NumPy
======
$ grep -r '^class [A-Z]' --include "*.py" * | wc -l
1014
$ grep -r  '^class' --include "*.py" * | grep -v 'class [A-Z]' | wc -l
207

SciPy
=====
$ grep -r '^class [A-Z]' --include "*.py" * | wc -l
587
$ grep -r  '^class' --include "*.py" * | grep -v 'class [A-Z]' | wc -l
565

So far, there is Universal support for the basic idea of conforming to
the Python Style Guide.  Since it should effect the user API, we have
already updated the TestCase classes.  First, we checked in a change
to allow TestCase classes to be prefixed with
either 'test' or 'Test':
http://projects.scipy.org/scipy/numpy/changeset/4144
Then, we updated both SciPy and NumPy to use CapWords for TestCase classes:
http://projects.scipy.org/scipy/numpy/changeset/4151
http://projects.scipy.org/scipy/scipy/changeset/3388
In order to run the SciPy tests on the trunk you will need to install
NumPy from svn revision 4144 or greater.  Before SciPy 0.7.0 is
released, we will release NumPy 1.0.4.

Also, if you are adding a new class to NumPy or SciPy, please use
CapWords.  Now we need to decide what to do about the remaining
lower_underscore_separated class names.  Obviously, it is important
that we are careful to not break a lot of code just to bring our class
names up to standards.

Cheers,

--

-- 
Jarrod Millman
Computational Infrastructure for Research Labs
10 Giannini Hall, UC Berkeley
phone: 510.643.4014
http://cirl.berkeley.edu/
Perry Greenfield | 2 Oct 20:40

Re: adopting Python Style Guide for classes


On Oct 2, 2007, at 1:24 PM, Jarrod Millman wrote:

> So far, there is Universal support for the basic idea of conforming to
> the Python Style Guide.  Since it should effect the user API, we have

I'm somewhat startled to see this. Perhaps my memory is very bad, but  
I seem to recall that there was an explicit decision in the past not  
to use the Python conventions for class names. The reason I recall  
was that scientists and engineers don't like them (or something like  
that). I also recall that this was a strongly held opinion by some  
very influential in the scipy effort ;-)

Mind you, I wasn't one of those that felt that strongly about it, but  
do realize that the people that are voting here are not your typical  
users. So before this is considered a "universal" opinion, I'd like  
to see some of those that made the decision the other way bless it  
(and some rationale for the switch that addresses the original  
decision).

Eric, Travis, what say you?

Perry
Robert Kern | 2 Oct 20:49
Gravatar

Re: adopting Python Style Guide for classes

Perry Greenfield wrote:
> On Oct 2, 2007, at 1:24 PM, Jarrod Millman wrote:
> 
>> So far, there is Universal support for the basic idea of conforming to
>> the Python Style Guide.  Since it should effect the user API, we have
> 
> I'm somewhat startled to see this. Perhaps my memory is very bad, but  
> I seem to recall that there was an explicit decision in the past not  
> to use the Python conventions for class names. The reason I recall
> was that scientists and engineers don't like them (or something like  
> that). I also recall that this was a strongly held opinion by some  
> very influential in the scipy effort ;-)

The reason that was recorded was to give everything the same interface,
regardless of what it was, for the sake of non-programmers who are learning to
program ("For those that object, you are skilled enough to deal with the
limitation."). However, we are beginning to deviate strongly from the rest of
the community, and (at least in my opinion) any benefit you get from internal
consistency is extremely weak, but the annoyance of being inconsistent with the
rest of the Python world is fairly strong. No one uses just numpy and scipy.

> Mind you, I wasn't one of those that felt that strongly about it, but  
> do realize that the people that are voting here are not your typical  
> users. So before this is considered a "universal" opinion, I'd like  
> to see some of those that made the decision the other way bless it  
> (and some rationale for the switch that addresses the original  
> decision).
> 
> Eric, Travis, what say you?

They're in on it. However, they're also busy at a customer site for the week, so
I get to speak for them.  :-)

--

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco
Jarrod Millman | 3 Oct 01:06
Picon
Favicon
Gravatar

Fwd: Scientific Programmer Position at UC Berkeley

Hello everyone,

This position will involve a fairly heavy amount of Python
programming.  Feel free to contact either Fritz or myself if you have
any questions.

Thanks,
Jarrod

---------- Forwarded message ----------
From: Fritz Sommer <fsommer <at> berkeley.edu>
Date: Oct 2, 2007 4:04 PM
Subject: Fwd: Scientific Programmer Position at UC Berkeley
To: Jarrod Millman <millman <at> berkeley.edu>

SCIENTIFIC PROGRAMMER POSITION

The Sommer lab at UC Berkeley seeks a scientific programmer to assume
an integral role in the design and maintenance of the Core Services
of the new NSF-Initiative Data-Sharing in Neuroscience, hosted at the
Redwood Center for Theoretical Neuroscience and the Helen Wills
Neuroscience Institute. Specifically, work involves the design and
administration of the data repository and website used for this
initiative. This includes the integration and design of these
resources, the development and documentation of tools for data
sharing, maintaining a data server, design and maintenance of a
website, as well as support and interaction with data contributors.

Qualifications:
*Interest in Neuroscience
*Expertise in Python, Matlab, XML and HTML
*Experience with content management systems (PLONE) and version
control (CVS or SVN)
*Experience with binary data formats and hierarchical data formats
(HDF5)
*Familiarity with different unix-like platforms (Linux and Mac OS X).
*Strong problem-solving abilities

Salary and start date
The monthly salary range is $3987 - $7318, although most offers will
not exceed midpoint of the salary range.
Open: immediately, with preferred start date 15 Oct 2007 or earlier.
Minimum one year commitment preferred.

How to apply
U.C. Berkeley has an online applicant website. Visit:
http://jobs.berkeley.edu/ and search for job #007217.
If you have any questions, please contact Fritz Sommer:
fsommer <at> berkeley.edu

------------------------------------------------------------------------
-----
Friedrich T. Sommer, Ph.D., Associate Adjunct Professor
University of California, Berkeley
Redwood Center for Theoretical Neuroscience & HWNI
3210F Tolman Hall MC 3192
Berkeley, CA 94720
phone (510) 642-7251
fax (510) 642-7206
http://redwood.berkeley.edu/wiki/Fritz_Sommer
Picon
Picon
Favicon

Setting up your editor for NumPy/SciPy

Hi all,

Since we are busy cleaning up the NumPy and SciPy sources, I'd like to
draw your attention to the guidelines regarding whitespace.

We use 4 spaces per indentation level, in Python and C code alike (see
PEP 7: http://www.python.org/dev/peps/pep-0007/ under the heading
Python 3000).  Lines should be a maximum of 79 characters long (to
facilitate reading in text terminals), and must not have trailing
whitespace.

PEP 8 (http://www.python.org/dev/peps/pep-0008/) states:

    """
    The preferred way of wrapping long lines is by using Python's
    implied line continuation inside parentheses, brackets and braces.
    If necessary, you can add an extra pair of parentheses around an
    expression, but sometimes using a backslash looks better.  Make
    sure to indent the continued line appropriately.
    """

I attach a file, containing some common errors, which you can use to
setup your editor.  I also attach the settings I use under Emacs to
highlight the problems.

Regards
Stéfan
Attachment (bad_whitespace.py): text/x-python, 440 bytes
=========================================
Configuring Emacs for NumPy/SciPy editing
=========================================

.. contents ::

.. note ::

   Downloaded lisp (``.el``) files should be placed in a directory on
   the Emacs path.  I typically use ``~/elisp`` and add it to the
   search path using

   ::

     (add-to-list 'load-path "~/elisp")

Essential to producing well-formed code
=======================================

Never use tabs
--------------

::

  (setq-default indent-tabs-mode nil)

Clean up tabs and trailing whitespace
-------------------------------------

``M-x untabify``

and

``M-x whitespace-cleanup``

Highlight unnecessary whitespace
--------------------------------

Download
`show-wspace.el <http://www.emacswiki.org/cgi-bin/wiki/show-wspace.el>`__

::

  ; Show whitespace
  (require 'show-wspace)
  (add-hook 'python-mode-hook 'highlight-tabs)
  (add-hook 'font-lock-mode-hook 'highlight-trailing-whitespace)

Wrap lines longer than 79 characters
------------------------------------

::

  (setq fill-column 79)

The ``fill-paragraph`` command (``M-q`` or ``ESC-q``) also comes in
handy.

Other useful tools
==================

Highlight column 79
-------------------

Prevent lines from exceeding 79 characters in length.

Download
`column-marker.el <http://www.emacswiki.org/cgi-bin/wiki/column-marker.el>`__

::

  (require 'column-marker)
  (add-hook 'font-lock-mode-hook (lambda () (interactive) (column-marker-1 80)))

Show a ruler with the current column position
---------------------------------------------

::

  (require 'ruler-mode)
  (add-hook 'font-lock-mode-hook 'ruler-mode)

Enable restructured text (ReST) editing
---------------------------------------

::

  (require 'rst)
  (add-hook 'text-mode-hook 'rst-text-mode-bindings)

Fix outline-mode to work with Python
------------------------------------

::

  (add-hook 'python-mode-hook 'my-python-hook)
  (defun py-outline-level ()
    "This is so that `current-column` DTRT in otherwise-hidden text"
    ;; from ada-mode.el
    (let (buffer-invisibility-spec)
      (save-excursion
        (skip-chars-forward "\t ")
        (current-column))))

::

  ; this fragment originally came from the web somewhere, but the outline-regexp
  ; was horribly broken and is broken in all instances of this code floating
  ; around.  Finally fixed by Charl P. Botha
  ; <<a href="http://cpbotha.net/">http://cpbotha.net/</a>>
  (defun my-python-hook ()
    (setq outline-regexp "[^ \t\n]\\|[ \t]*\\(def[ \t]+\\|class[ \t]+\\)")
    ; enable our level computation
    (setq outline-level 'py-outline-level)
    ; do not use their \C-c@ prefix, too hard to type. Note this overides 
    ;some python mode bindings
    ;(setq outline-minor-mode-prefix "\C-c")
    ; turn on outline mode
    (outline-minor-mode t)
    ; initially hide all but the headers
    ; (hide-body)
    (show-paren-mode 1)
  )
_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev
Perry Greenfield | 3 Oct 17:43

Re: [SciPy-dev] adopting Python Style Guide for classes

To follow on to my previous posting on this topic given Robert's  
response.

As I said previously, I was never strongly committed to one approach  
or the other. But since the v1 release has been made, I think more  
care needs to be given to consideration of proposals like this before  
actually charging off to make the changes.

1) Even though Robert is speaking for Travis, I think given Travis's  
role in numpy, it is important for Travis to speak directly to this  
when he gets the chance.

2) API changes should only be made in major releases, not minor  
releases (IMHO).

3) Greater time should be provided to accommodate the transition. For  
example, there should not be deprecation warnings in the first  
version that this API appears in. The first release of this should  
not lead to nuisance messages for those that have other software that  
depends on this. (A tool that allows conditional messages would be  
good, but the default should be no message). The next release, sure.  
As a result, it means that the old API can't be removed until at  
least two releases after that.

4) More information should be provided as to what actually will  
change in the public interface. I suspect that it isn't obvious to  
many what will change. From the mailing list discussions there  
doesn't even seem to be consensus on the factory functions or type  
objects (more on these later). Many of the remaining objects are  
probably used internally (essentially private) and will affect few  
outside of the numpy developers. Since users typically deal mostly  
with factory functions, and other functions, they may not deal with  
classes much (outside of types). So listing the public classes so  
affected will help people understand what changes typical users will  
see, and what changes advanced users will see. While this is  
annoying, I think someone needs to write up an explicit list of those  
public classes that will be changed (and those that won't) so we all  
know what we will face. It may be a very small list and thus  
alleviate concern about the process. It may show some surprises that  
people hadn't thought about. Not doing this before making the changes  
seems very unwise.

5) In my humble opinion, we would be nuts--absolutely nuts--to change  
either the type classes or the factory functions. This would be  
foolish consistency at it's worst. We *just* went through the  
exercise of changing Int32 to int32 and so forth and we would have to  
change back again? This cannot be seriously considered.

Perry Greenfield

On Oct 2, 2007, at 1:24 PM, Jarrod Millman wrote:

> Hello,
>
> For those of you not on the Numpy developer's list, we have been
> talking about adopting the Python class naming convention to conform
> with Guido's style guide as closely as possible:
> http://www.python.org/dev/peps/pep-0008/
> According to Guido,  class names should use the CapWords convention.
> Most Python projects (eg, ETS, matploltlib) adhere to the Python
> naming conventions and it is confusing that NumPy and SciPy don't.
>
> Currently, both NumPy and SciPy use either lower_underscore_separated
> or CapWords for class names.
>
> NumPy
> ======
> $ grep -r '^class [A-Z]' --include "*.py" * | wc -l
> 1014
> $ grep -r  '^class' --include "*.py" * | grep -v 'class [A-Z]' | wc -l
> 207
>
> SciPy
> =====
> $ grep -r '^class [A-Z]' --include "*.py" * | wc -l
> 587
> $ grep -r  '^class' --include "*.py" * | grep -v 'class [A-Z]' | wc -l
> 565
>
> So far, there is Universal support for the basic idea of conforming to
> the Python Style Guide.  Since it should effect the user API, we have
> already updated the TestCase classes.  First, we checked in a change
> to allow TestCase classes to be prefixed with
> either 'test' or 'Test':
> http://projects.scipy.org/scipy/numpy/changeset/4144
> Then, we updated both SciPy and NumPy to use CapWords for TestCase  
> classes:
> http://projects.scipy.org/scipy/numpy/changeset/4151
> http://projects.scipy.org/scipy/scipy/changeset/3388
> In order to run the SciPy tests on the trunk you will need to install
> NumPy from svn revision 4144 or greater.  Before SciPy 0.7.0 is
> released, we will release NumPy 1.0.4.
>
> Also, if you are adding a new class to NumPy or SciPy, please use
> CapWords.  Now we need to decide what to do about the remaining
> lower_underscore_separated class names.  Obviously, it is important
> that we are careful to not break a lot of code just to bring our class
> names up to standards.
>
> Cheers,
>
> -- 
> Jarrod Millman
> Computational Infrastructure for Research Labs
> 10 Giannini Hall, UC Berkeley
> phone: 510.643.4014
> http://cirl.berkeley.edu/
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev <at> scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
Ondrej Certik | 3 Oct 18:04
Picon
Gravatar

Re: adopting Python Style Guide for classes

> As I said previously, I was never strongly committed to one approach
> or the other. But since the v1 release has been made, I think more
> care needs to be given to consideration of proposals like this before
> actually charging off to make the changes.
>
> 1) Even though Robert is speaking for Travis, I think given Travis's
> role in numpy, it is important for Travis to speak directly to this
> when he gets the chance.
>
> 2) API changes should only be made in major releases, not minor
> releases (IMHO).
>
> 3) Greater time should be provided to accommodate the transition. For
> example, there should not be deprecation warnings in the first
> version that this API appears in. The first release of this should
> not lead to nuisance messages for those that have other software that
> depends on this. (A tool that allows conditional messages would be
> good, but the default should be no message). The next release, sure.
> As a result, it means that the old API can't be removed until at
> least two releases after that.
>
> 4) More information should be provided as to what actually will
> change in the public interface. I suspect that it isn't obvious to
> many what will change. From the mailing list discussions there
> doesn't even seem to be consensus on the factory functions or type
> objects (more on these later). Many of the remaining objects are
> probably used internally (essentially private) and will affect few
> outside of the numpy developers. Since users typically deal mostly
> with factory functions, and other functions, they may not deal with
> classes much (outside of types). So listing the public classes so
> affected will help people understand what changes typical users will
> see, and what changes advanced users will see. While this is
> annoying, I think someone needs to write up an explicit list of those
> public classes that will be changed (and those that won't) so we all
> know what we will face. It may be a very small list and thus
> alleviate concern about the process. It may show some surprises that
> people hadn't thought about. Not doing this before making the changes
> seems very unwise.
>
> 5) In my humble opinion, we would be nuts--absolutely nuts--to change
> either the type classes or the factory functions. This would be
> foolish consistency at it's worst. We *just* went through the
> exercise of changing Int32 to int32 and so forth and we would have to
> change back again? This cannot be seriously considered.

I strongly agree with all 1) to 4) above. It's really important not to
break things for the end user at the end and 1) through 4) is the way
to do it. (I don't know much background about 5) to make a judgement).

Ondrej Certik
Jarrod Millman | 3 Oct 20:26
Picon
Favicon
Gravatar

Re: adopting Python Style Guide for classes

On 10/3/07, Perry Greenfield <perry <at> stsci.edu> wrote:
> 2) API changes should only be made in major releases, not minor
> releases (IMHO).

+1

> 3) Greater time should be provided to accommodate the transition. For
> example, there should not be deprecation warnings in the first
> version that this API appears in. The first release of this should
> not lead to nuisance messages for those that have other software that
> depends on this. (A tool that allows conditional messages would be
> good, but the default should be no message). The next release, sure.
> As a result, it means that the old API can't be removed until at
> least two releases after that.

I am not sure I agree with this.  For example, I think it would be
acceptable for NumPy 1.1.0 to have deprecation warning about changed
APIs.  Perhaps you were saying that NumPy 1.0.4 could use the new
class names in addition to the old names without complaint.  That
sounds reasonable to me.  Then when NumPy 1.1.0 comes out the old
style names would raise deprecation warnings.

> 4) More information should be provided as to what actually will
> change in the public interface. I suspect that it isn't obvious to
> many what will change. From the mailing list discussions there
> doesn't even seem to be consensus on the factory functions or type
> objects (more on these later). Many of the remaining objects are
> probably used internally (essentially private) and will affect few
> outside of the numpy developers. Since users typically deal mostly
> with factory functions, and other functions, they may not deal with
> classes much (outside of types). So listing the public classes so
> affected will help people understand what changes typical users will
> see, and what changes advanced users will see. While this is
> annoying, I think someone needs to write up an explicit list of those
> public classes that will be changed (and those that won't) so we all
> know what we will face. It may be a very small list and thus
> alleviate concern about the process. It may show some surprises that
> people hadn't thought about. Not doing this before making the changes
> seems very unwise.

As long as we agree in principle how we want classes named, I think
there is little need to rush to change existing class names.

> 5) In my humble opinion, we would be nuts--absolutely nuts--to change
> either the type classes or the factory functions. This would be
> foolish consistency at it's worst. We *just* went through the
> exercise of changing Int32 to int32 and so forth and we would have to
> change back again? This cannot be seriously considered.

I think that the general consensus is that we should keep int32,
rather than switch to Int32.

--

-- 
Jarrod Millman
Computational Infrastructure for Research Labs
10 Giannini Hall, UC Berkeley
phone: 510.643.4014
http://cirl.berkeley.edu/

Gmane