BF: fix missed extension status check on Python 3

Python 3 was doing the check wrong for extension status == 0; integer
slicing into a byte array results in an integer, so comparison of this
integer against a byte string was always false.  This is OK as long as
the offset is default, but gives an error later if the offset is higher
than the default minimum.
RF: add write0 to seek_tell function and test

Add flag to allow seek_tell to write zeros to reach a given file offset,
if it can't get there with a seek.
BF: test and fix writing of bz2 files with offsets

Writing a bz2 file that wasn't already at the data offset position
caused IOError because of failed write seek on bz2 files.

Use extended seek_tell function to write zeros to reach offset, when
seek fails.
RF: remove redundant _write_header method

We only used image _write_header method for seeking to the data position
in a nifti single image.  Now I've moved that logic to seek_tell, and
therefore 'Analyze.to_file_map', we don't need _write_header.  Remove.
There aren't any good tests for parrec2nii - so I have to hope changes
worked right.
NF: context manager for imageglobals error level

Context manager to set and unset imageglobals module constant
TST: add test for outputs from header scaling

I'm about to refactor the header scaling dramatically, but I don't want
to change the default output from given input header scalings.  Check
the output from some odd header scalings before the refactor.
RF: move slope inter and scaling tests to classes

Slightly expand test coverage by moving checks of slope and inter, and
of scaling, from functions to methods of the header test classes.
RF: break up nifti tests to ease refactoring

Break up nifti tests into separate methods for easier refactoring.

Add helper test function for checking no log errors
RF: expand scaling checks in get_slope_inter

Make header `get_slope_inter()` do checks for non-finite etc scaling for
all Analyze types.

Raise error in `get_slope_inter` if there is a valid slope but invalid
intercept.  This is the default when reading a header from disc from the
log checks, but I'm going to remove the log checks soon, and I want to
preserve the logic set in `TestAnalyzeImage.test_header_scaling()`
RF: remove all log checks and fixes for scaling

We're going to allow NaN as a valid slope and / or intercept. Up until
now we've ignored slope and intercept values in writing the image.

For simplicity, remove all header log checks and fixes for scaling.

Do all necessary reinterpretation of scale factors in `get_slope_inter`
RF: allow None as input to apply_read_scaling

Else where we've used None as shorthand for no scaling, so allow None
for slope and intercept in apply_read_scaling function.
RF: allow NaN in header.set_slope_inter()

NaN will the be signal to allow the image to do scaling on write, so
allow NaN as an input value to `set_slope_inter`
RF+API: NaN slope/inter default in set_slope_inter

Make NaN the default for slope and intercept when passing Nones to
`header.set_slope_inter()`
RF: allow integer slope, inter in array_to_file

Integer intercept with slope==1 previously caused errors when checking
the intercept type, because the intercept check was not expecting an
array. Squeeze the intercept array for the check.
RF+TST: text and fix int to int without scaling

I wasn't clipping the arrays properly when doing int to int scaling
with identity scaling.  Test and fix.

Add test for non-numeric input dtype.
RF: default arguments for private function

Make default arguments to mn, mx arguments of _dt_min_max function for
convenience.
BF+TST: make sure longs work in slice objects

Use Python 2 / 3 compatible check for integer slices to make sure that
Python 2 long objects work as slice definitions.
RF: make sure longs allowed for int_to_float

Use six 'integer_types' for isinstance check when testing for integers.
NF: add check_scaling keyword to ArrayWriter

Let user tell ArrayWriter to continue even if the array needs scaling
for write of full range.
RF: stop array_to_file using float16 working type

Don't allow float16 as a working type (it's about 10 times slower than
float64).  Instead of upcasting input implicitly with the slope and
intercept, upcast explicitly during write.