SNID Frequently Asked Questions

You are here: SNID > Frequently Asked Questions
You can also access: manual

Contents: Installation problems and Compilation errors | Runtime errors | General questions

Installation problems and Compilation errors

NOTE: If you do get error messages after typing "make" then make sure you clean up before attempting to recompile. This is done by typing:
	make realclean ; make
If the compilation then succeeds you can type 'make install' to copy the executable files to the bin/ directory.

Runtime errors

General questions

Compilation errors

Compilation problems under Ubuntu 14.x

You might encounter errors of the form:
    xwdriv.c:(.text+0x236): undefined reference to `XCopyArea'
    xwdriv.c:(.text+0x4f3): undefined reference to `XFree'
    ...
when attempting to compile SNID under Ubuntu 14.x. It seems that Ubuntu uses the --as-needed linker flag as a default instead of --no-as-needed on other systems, which means that some libraries are effectively not linked (unless the -l commands are placed after the -o in the makefile). I was able to compile SNID by simply changing:
FFLAGS= -O -fno-automatic
to:
FFLAGS= -O -fno-automatic -Wl,--no-as-needed
in the Makefile.

How can I compile SNID with MacPorts PGPLOT under OSX 10.9?

If you are trying to compile SNID with MacPorts PGPLOT under OSX 10.9 (Mavericks), you can use gfortran-mp-4.8 instead of g77. Follow these simple steps:
  1. Clean up any previously-compiled libraries and executables by executing the following command in the SNID installation directory:
          make realclean
    
  2. Edit the Makefile in the button/ subdirectory and point to the correct fortran compiler:
          FC= gfortran-mp-4.8
    
  3. Edit the Makefile in the SNID install directory (i.e. snid-5.0/Makefile) point to the correct fortran compiler. Additionally, you will need to replace -laquaterm with -framework AquaTerm in the PGLIBS settings and point to the correct path for the PGPLOT libraries (by default /opt/local/lib with Macports). Your compiler settings should look like this:
          FC= gfortran-mp-4.8
          FFLGAS= -O -fno-automatic
          XLIBS= -L/usr/X11/lib -lX11
          PGLIBS= -L/opt/local/lib/pgplot -lpgplot
    
  4. Last, remember to set the the LD_LIBRARY_PATH and PGPLOT_DIR environment variables to point to the PGPLOT installation directory (see the note in the Makefile and the Installation instructions).
    [in (t)csh]
          setenv LD_LIBRARY_PATH /opt/local/lib/pgplot
          setenv PGPLOT_DIR /opt/local/lib/pgplot
    
    [in bash]
          export LD_LIBRARY_PATH="/opt/local/lib/pgplot"
          export PGPLOT_DIR="/opt/local/lib/pgplot"
    
  5. You can now recompile SNID. In the SNID install directory, execute:
          make
          make install
    
Many thanks to Gautham Narayan for writing up detailed instructions on compiling SNID with MacPorts PGPLOT under Mac OS 10.9.

I do not have a Fortran compiler on my computer. Where can I get one?

Mac PPC and Intel: You can install g77 and gfortran binaries at High-performance computing for Mac OS X. Note that you will need to have Apple's Developer Tools installed. They are included on a separate CD in the retail version of OS X and also available as a free download from Apple's Developer Site.

UNIX/Linux/etc.: You can install g77 or gfortran through the GNU Compiler Collection (GCC). Note that the final release of g77 is in GCC version 3.4. Future versions of GCC have gfortran instead.

PGPLOT is not installed on my computer. How do I install it?

Mac PPC and Intel: You can download Scisoft OSX, which (amongst many other things) includes PGPLOT. Scisoft OSX is available for both Mac PPC and Intel.

PGPLOT is also available as an "unstable package" through Fink. "Unstable" packages can be made available in Fink Commander by checking "Use unstable packages" in the "Fink" tab of the Fink Commander Preferences panel. If you use the command line version of Fink, then you will need to edit /sw/etc/fink.conf, add unstable/main and unstable/crypto to the Trees: line, and then run fink selfupdate; fink index. You can then install the Package pgplot by typing:

	fink install pgplot
at the terminal prompt.

Update (12 Nov 2012): If you're running Mac OS X 10.6 or later and/or 64-bit CPU Macs, check out Compiling PGPLOT on Mac OS X for detailed instructions on how to install/compile PGPLOT.

UNIX/Linux/etc.: You can download PGPLOT here. That website also includes installation instructions for UNIX, Linux, VMS, and Windows. Part of the installation requires you select specific device drivers from a file called drivers.list. For SNID, the only device drivers you will need are:

        AQDRIV 0 /AQT 	    AquaTerm.app under Mac OS X     		C        <=== ONLY FOR MAC OSX!
	PSDRIV 1 /PS        PostScript printers, monochrome, landscape	Std F77
	PSDRIV 3 /CPS       PostScript printers, color, landscape	Std F77
	XWDRIV 1 /XWINDOW   Workstations running X Window System	C
	XWDRIV 2 /XSERVE    Persistent window on X Window System	C
although the complete recommended list is:
        AQDRIV 0 /AQT 	    AquaTerm.app under Mac OS X     		C        <=== ONLY FOR MAC OSX!
	GIDRIV 1 /GIF       GIF-format file, landscape
	GIDRIV 2 /VGIF      GIF-format file, portrait
	LXDRIV 0 /LATEX     LaTeX picture environment
	PSDRIV 1 /PS        PostScript printers, monochrome, landscape	Std F77
	PSDRIV 2 /VPS       Postscript printers, monochrome, portrait	Std F77
	PSDRIV 3 /CPS       PostScript printers, color, landscape	Std F77
	PSDRIV 4 /VCPS      PostScript printers, color, portrait	Std F77
	TTDRIV 4 /GTERM     GTERM Tektronix terminal emulator		Std F77
	TTDRIV 5 /XTERM     XTERM Tektronix terminal emulator		Std F77
	WDDRIV 1 /WD        X Window dump file, landscape
	WDDRIV 2 /VWD       X Window dump file, portrait
	XWDRIV 1 /XWINDOW   Workstations running X Window System	C
	XWDRIV 2 /XSERVE    Persistent window on X Window System	C
NOTE: Do not install any of the widget drivers unless you are planning to develop programs that will use them.

Compiling PGPLOT with gfortran under Linux: make sure you use 'linux g77_gcc_aout' as the 3rd and 4th arguments to the makemake command. You'll then need to edit the makefile to replace:

FCOMPL=g77
with
FCOMPL=gfortran

PGPLOT yields a link error: "ld: cannot find -lpgplot"

This means SNID is not finding the pgplot libraries. You need to locate libpgplot.* and add its location to the Makefile. This means editing the PGLIBS setting to reflect the location of these libraries. E.g., assuming the libpgplot.so library is in /opt/lib/pgplot/:
	PGLIBS= -L/opt/lib/pgplot -lpgplot

libpgplot.so gives an error "undefined reference to 'png_...'"

This means SNID is not finding the png libraries. You need to locate libpng.* and add its location to the Makefile. This means editing the PGLIBS setting to explicitely add the libpng library. E.g., assuming the libpng.so library is in /usr/lib/:
	PGLIBS= -L/usr/local/pgplot -lpgplot /usr/lib/libpng.so
NOTE: the PGPLOT libraries may not be located at /usr/local/pgplot/. If this is the case, edit the PGLIBS settings accordingly.

libpgplot.so gives an error "undefined reference to " followed by incomprehensible symbols (e.g. e_wsfe, s_rsfe, do_uio etc.)

This could mean that PGPLOT was compiled with a different fortran compiler than you're trying with SNID. For instance, if attempting to compile SNID with gfortran when PGPLOT was compiled with g77, you'd get something like:
	libpgplot.so: undefined reference to `e_wsfe'
	libpgplot.so: undefined reference to `s_rsfe'
	libpgplot.so: undefined reference to `s_cmp'
	libpgplot.so: undefined reference to `do_uio'
	libpgplot.so: undefined reference to `e_rsfe'
	libpgplot.so: undefined reference to `f_inqu'
	libpgplot.so: undefined reference to `e_rsue'
	libpgplot.so: undefined reference to `i_indx'
	libpgplot.so: undefined reference to `do_fio'
	libpgplot.so: undefined reference to `e_wsfi'
	libpgplot.so: undefined reference to `s_cat'
	libpgplot.so: undefined reference to `s_stop'
	libpgplot.so: undefined reference to `s_wsfi'
	libpgplot.so: undefined reference to `G77_getenv_0'
	libpgplot.so: undefined reference to `s_rsue'
	libpgplot.so: undefined reference to `f_clos'
	libpgplot.so: undefined reference to `f_open'
	libpgplot.so: undefined reference to `s_wsfe'
	libpgplot.so: undefined reference to `s_copy'
	collect2: ld returned 1 exit status
	make: *** [snid] Error 1

libpgplot.so gives an error "cannot open shared object file: No such file or directory"

This generally means you have not set the LD_LIBRARY_PATH and PGPLOT_DIR environment variables to point to the PGPLOT installation directory (see the note in the Makefile and the Installation instructions).
[in (t)csh]
      setenv LD_LIBRARY_PATH /usr/local/pgplot
      setenv PGPLOT_DIR /usr/local/pgplot

[in bash]
      export LD_LIBRARY_PATH="/usr/local/pgplot"
      export PGPLOT_DIR="/usr/local/pgplot"
NOTE: the PGPLOT installation directory may not be located at /usr/local/pgplot/. If this is the case, edit the LD_LIBRARY_PATH and PGPLOT_DIR settings accordingly.

Runtime errors

Everything works fine until the interactive plotting: "ERROR: unable to open graphic device."

This generally means you have not set the LD_LIBRARY_PATH and PGPLOT_DIR environment variables to point to the PGPLOT installation directory (see the note in the Makefile and the Installation instructions).
[in (t)csh]
      setenv LD_LIBRARY_PATH /usr/local/pgplot
      setenv PGPLOT_DIR /usr/local/pgplot

[in bash]
      export LD_LIBRARY_PATH="/usr/local/pgplot"
      export PGPLOT_DIR="/usr/local/pgplot"
NOTE: the PGPLOT installation directory may not be located at /usr/local/pgplot/. If this is the case, edit the LD_LIBRARY_PATH and PGPLOT_DIR settings accordingly.

PGPLOT complains it can't read the font file "grfont.dat" or that it couldn't find the program "pgxwin_server"

This generally means you have not set the LD_LIBRARY_PATH and PGPLOT_DIR environment variables to point to the directory containing the libpgplot.* library (see the note in the Makefile and the Installation instructions).
[in (t)csh]
      setenv LD_LIBRARY_PATH /usr/local/pgplot
      setenv PGPLOT_DIR /usr/local/pgplot

[in bash]
      export LD_LIBRARY_PATH="/usr/local/pgplot"
      export PGPLOT_DIR="/usr/local/pgplot"
NOTE: the PGPLOT libraries may not be located at /usr/local/pgplot/. If this is the case, edit the LD_LIBRARY_PATH and PGPLOT_DIR settings accordingly.

PGPLOT complains: "%PGPLOT: selected graphics device is not open"

I encountered this problem with the Scisoft OSX distribution of PGPLOT on a Mac Intel. The problem was that the "/XSERVE" device driver was commented out in the drivers.list file in the pgplot directory (/scisoft/i386/Packages/pgplot-5.2.2/ for the Mac Intel distribution):
! XWDRIV 2 /XSERVE    Persistent window on X Window System		C
(The ! at the start of the line means it is commented out). If this is the case, or if any of the following lines are commented out:
 AQDRIV 0 /AQT 	     AquaTerm.app under Mac OS X     			C
 PSDRIV 1 /PS        PostScript printers, monochrome, landscape         Std F77
 PSDRIV 3 /CPS       PostScript printers, color, landscape		Std F77
 XWDRIV 1 /XWINDOW   Workstations running X Window System		C
 XWDRIV 2 /XSERVE    Persistent window on X Window System		C
then this means you have to recompile PGPLOT. No worries, it isn't that complicated! Follow these steps and you should be fine:
  1. go to the pgplot installation directory (here I assume it's /scisoft/i386/Packages/pgplot-5.2.2/):
          cd /scisoft/i386/Packages/pgplot-5.2.2/
    
  2. edit the drivers.list file and uncomment (remove the ! at the start of the line) the following lines:
     AQDRIV 0 /AQT 	     AquaTerm.app under Mac OS X     			C
     PSDRIV 1 /PS        PostScript printers, monochrome, landscape         Std F77
     PSDRIV 3 /CPS       PostScript printers, color, landscape		Std F77
     XWDRIV 1 /XWINDOW   Workstations running X Window System		C
     XWDRIV 2 /XSERVE    Persistent window on X Window System		C
    
    your drivers.list file should look something like this.

  3. generate the Makefile using the makemake command:
          sudo ./makemake . macosx g77_gcc_AQT        [if you use g77 as your fortran compiler]
    OR    sudo ./makemake . macosx gfortran_gcc_AQT   [if you use gfortran as your fortran compiler]
    
    which should produce the following output:
          Reading configuration file: ./sys_macosx/g77_gcc_AQT.conf
          Selecting uncommented drivers from ./drivers.list
          Found drivers AQDRIV PSDRIV XWDRIV
          Creating make file: makefile
          Determining object file dependencies.
    
  4. compile PGPLOT using the make command:
          sudo ./make
    
  5. recompile SNID by executing the following commands in the SNID installation directory (snid-5.0/):
          make realclean ; make
          make install
    
If the steps above do not work, then you should try using the Fink distribution of PGPLOT instead (see above).

Angstrom symbol shows up as \\AA etc.

Simply replace any occurrence of '\\' by a single '\' in the following lines of the plotlnw.f and snidplot.f source files:
plotlnw.f:298:      xtit='Rest Wavelength [\\A]'
snidplot.f:457:      xtit='Observed Wavelength [\\A]'
snidplot.f:459:      tit='Rest Wavelength [\\A]'
snidplot.f:488:     $     dlabels(5)(:lnb(dlabels(5)))//'\\(2233)'//
snidplot.f:603:      xtit='Observed Wavelength [\\A]'
snidplot.f:605:      tit='Rest Wavelength [\\A]'
snidplot.f:634:     $     dlabels(5)(:lnb(dlabels(5)))//'\\(2233)'//
snidplot.f:1039:      tit='Redshift vs. Age for correlations with rlap \\(2244) '//
snidplot.f:1081:      call pgmtxt('T',-4.75,.75,0,'\\(0806) \\(0806) \\(0806) '//
snidplot.f:1086:     $        labels(3)(:lnb(labels(3)))//'| \\(2244) '//
snidplot.f:1185:      ytit='Template fraction \\(2244) rlap'
snidplot.f:1325:      ytit='Template fraction \\(2244) rlap'
Thanks to Don Neill for pointing this out.

SNID quits prematurely with a "Bus error."

This should never have happened. Please email me so we can figure out a solution: my
email. In your email, you should specify your OS, fortran compiler, and the complete screen output up until the error is generated. One possible solution would be to reinstall different versions of the aquaterm and pgplot libraries (e.g. through macports). Apparently there are problems with those libraries within Scisoft OSX, Intel version 2009.9.1 (thanks to Ben Dilday for pointing this out).

SNID quits prematurely with a "Segmentation fault."

This should never have happened. Please email me so we can figure out a solution: my
email. In your email, you should specify your OS, fortran compiler, and the complete screen output up until the error is generated.

I found a bug/problem in SNID. What should I do?

Well, that is possible. Please email me so we can figure out a solution: my
email. Make sure to include all the relevant information (as well as your OS and fortran compiler).

General questions

I don't really understand the text or graphical output. Is there a manual for SNID?

Sure there is. Check out the online manual, which includes an example run. Note that this is a replica of the Howto.snid file in the doc/ subdirectory of the snid distribution.

The redshift values output by SNID are way off. Can I restrict the redshift range in some way?

Yes. If you know the host galaxy redshift, you can force the intial redshift estimate with the forcez option. If you only have a rough idea of the redshift, you can restrict the redshift interval using the z and dz options. Look at the examples in the other examples section of the online manual.

The ages of the SN templates that show up in the Template Listings have a huge scatter. Is this normal?

There is a strong anti-correlation between redshift and age estimates (i.e. over-estimating the redshift leads to under-estimating the age) due to the shift of supernova absorption features to the red with age (see Blondin & Tonry 2007 [ADS, astro-ph] for more details). You can see this clearly with the "z/t" button in the interactive graphics window (see also this example plot). However, if you have some external constraint on the age of the SN spectrum, you can then restrict the correlation to templates within a certain age interval using the agemin, agemax, age, and dage options. Look at the examples in the other examples section of the online manual.

Is it possible that my input spectrum is of a different (sub)type than the "favoured (sub)type" output by SNID?

The type determination algorithm is far from perfect (see the example run), and its efficiency varies with SN type, age, and redshift (see Blondin & Tonry 2007 [ADS, astro-ph] for a lengthy discussion). This is in part due to the incompleteness of the spectral database, as some supernova types (e.g. non-"normal" SN Ia, SN Ib/c) are presently under-represented. It is strongly advisable to look at the best 5 or so template matches to make a judgment call. While running SNID on large datasets, however, this is unpractical, so one has to resort to this automated classification scheme. In Miknaitis et al. 2007 [ADS, astro-ph], for example, high-redshift supernovae from the ESSENCE survey were classified as 'Ia' if the best-match template was a 'Ia' and at least 50% of templates with rlap ≥ 5.0 were of the same type.

How can I add new (sub)types to SNID?

You need to edit the typeinfo.f file in the source subdirectory. You can simply add subtypes to the existing types (Ia, Ib, Ic, II, and NotSN), or even a new type, e.g. "WeirdSN":
* WeirdSN
      typename(6,1) = 'WeirdSN'  ! first element is the name of type
      typename(6,2) = 'WeirdSN1' ! subtypes follow...
      typename(6,3) = 'WeirdSN2'
      typename(6,4) = 'WeirdSN3'
After adding more (sub)types, make sure to change the values of the parameters NT and NST in the snid.inc file in the snid-5.0/source/ directory. NT is the total number of template types; NST is the maximum number of template subtypes in any given type, +1.

You'll then need to recompile SNID by executing the following commands in the SNID installation directory (snid-5.0/):
      make realclean ; make
      make install

Can I get SNID to work beyond 1 micron?

Yes!

The observed wavelength range searched by SNID is set to that found in the first template .lnw file (3rd and 4th number in first line of that file), which in the public release is 2500-10000 A, hence the cutoff at 1 micron. To extend the wavelength range further one "simply" needs to generate a new template set which extends beyond 1 micron. You should use the program logwave included in the snid-5.0 distribution. No modification of the source code is needed.

You can download new template-2.0 sets in the range 2500-20000 A, one with 1024 log wavelength bins, the other with 2048 bins: templates-2.0_2500_20000_1024.tgz (5.7 Mb) and templates-2.0_2500_20000_2048.tgz (11 Mb).

Just unpack them in your snid-5.0 install directory. Note that if you haven't already installed the templates-2.0 set you will need to edit snid.inc (step 3 in instructions in the README_templates-2.0 file) and recompile SNID.

You can then use the tempdir option to point to these template directories. Note that the default maximum redshift is zmax=1.3 in SNID, so you might need to alter that for your needs (just use the zmax option):
        snid tempdir=/path/to/templates-2.0_2500_20000_1024/ zmax=1.8 input_spectrum.dat

How can I use the new BSNIP v7.0 templates?

Silverman et al. [astro-ph] released a set of spectral templates based on data from the Berkeley SN Ia Program (BSNIP). Follow these steps if you want to use this new template set:
  1. Download the template set here.

  2. Unpack the .tar.gz file in a newly-created directory in your snid-5.0 installation directory (e.g. snid-5.0/templates_bsnip_v7.0/)

  3. In that newly-created directory, execute the following commands:
          ls *.lnw > templist
          cp ../templates/texplist .
          cp ../templates/tfirstlist .
    
  4. If you want this to be your default template set, edit line 52 of the snidmore.f file in the snid-5.0/source/ directory to point to this new template directory:
          tempdir='INSTALL_DIR/snid-5.0/templates_bsnip_v7.0/'
    
    Alternatively you can skip this step and simply use the tempdir option at runtime.

  5. Edit the typeinfo.f file in the snid-5.0/source/ directory to include the new Ia and NotSN subtypes, i.e.
          typename(1,7) = 'Ia-99aa'
          typename(1,8) = 'Ia-02cx'
    
    and
          typename(5,6) = 'QSO'
          typename(5,7) = 'C-star'
    
    Your typeinfo.f file should look like this.

  6. Set the NST variable equal to 8 in the snid.inc file in the snid-5.0/source/ directory:
          parameter (NST = 8)
    
  7. Recompile SNID by executing the following commands in the SNID installation directory (snid-5.0/):
          make realclean ; make
          make install
    
That's it!

Update (30 May 2016): the indices for the 'QSO' and 'C-star' subtypes were mistakenly inverted. If you installed this template set prior to 30 May 2016 you should download the new typeinfo.f file (here) and recompile SNID (step 7 above). Thanks to Jeff Silverman for pointing this out!

The input spectrum is heavily contaminated by galaxy/sky emission lines. Will this affect SNID?

Yes. You should clip galaxy emission lines using the emclip option. If there are also strong sky lines, you can clip them by setting skyclip=1. Look at the examples in the other examples section of the online manual.

The input spectrum is noisy at the blue/red ends. Will this affect SNID?

Yes. You should exclude noisy edges in the correlation by using the wmin and wmax options. Look at the examples in the other examples section of the online manual.

There are chip gaps in my input spectrum. Can I mask out specific wavelength intervals?

Yes, using the wmask option.

What does SNID stand for?

Supernova Identification. It does not stand for any of the following (found through Google):

Scandinavian Network for Infectious Diseases
Smart Network Interface Device
Studies in National and International Development
Subscriber Network Interface Device
Sud Nivernais Imphy Decize