RickKessler / SNANA

Supernova Analysis package
36 stars 23 forks source link

Starter Kit examples not working #362

Closed jorgearayac closed 3 years ago

jorgearayac commented 3 years ago

Hello We were doing the simulation of the Manual Starter Kit (https://readthedocs.org/projects/snana-starterkit/downloads/pdf/latest/) and had two different problems depending on what type of operating system was used. These are the files that we're using:

kcorPS1MD_test.simlib

TELESCOPE: PS1
SURVEY: PS1MD    FILTERS: griz
BEGIN LIBGEN  2016-3-28
# --------------------------------------------
LIBID: 1
RA: 0    DECL: 0 NOBS: 6 MWEBV: 0.024   PIXSIZE: 0.25
FIELD: 1
#                           CCD  CCD         PSF1 PSF2 PSF2/1
#     MJD      IDEXPT  FLT GAIN NOISE SKYSIG (pixels)  RATIO  ZPTAVG ZPTERR  MAG
S: 55074.600 0 g 1.0 0.0 6.8691 3.7960 0.0000 0.0000 30.2426 0.0034 -99
S: 55086.600 1 g 1.0 0.0 10.319 4.4315 0.0000 0.0000 30.1481 0.0034 -99
S: 55089.600 2 g 1.0 0.0 6.8671 2.8140 0.0000 0.0000 30.2175 0.0036 -99
S: 55095.500 3 g 1.0 0.0 7.2529 3.9464 0.0000 0.0000 30.3894 0.0041 -99
S: 55098.500 4 g 1.0 0.0 6.8112 3.3349 0.0000 0.0000 30.1146 0.0040 -99
S: 55101.600 5 g 1.0 0.0 7.4172 3.1407 0.0000 0.0000 30.1131 0.0037 -99
END_LIBID: 1
END_OF_SIMLIB: 1 ENTRIES

and sim_PS1.input

GENVERSION: PS1MD   # simname
GENSOURCE:  RANDOM
GENMODEL:   SALT2.JLA-B14
GENPREEFIX: YSE_IA
RANSEED: 128473   # random number seed

SIMLIB_FILE: PS1MD_test.SIMLIB   # simlib file

KCOR_FILE:  kcor_PS1.fits

NGEN_LC: 5

APPLY_SEARCHEFF_OPT: 1

EXPOSURE_TIME_FILTER: g 1.0
EXPOSURE_TIME_FILTER: r 1.0
EXPOSURE_TIME_FILTER: i 1.0
EXPOSURE_TIME_FILTER: z 1.0

GENFILTERS: griz

GENSIGMA_SEARCH_PEAKMJD:  1.0   # sigma-smearing for  SEARCH_PEAKMJD (days)

GENRANGE_PEAKMJD:  55000 56000
SOLID_ANGLE: 0.192

SEARCHEFF_PIPELINE_FILE:  $SNDATA_ROOT/sample_input_files/PS1_J17/SEARCHEFF_PIPELINE_PS1.DAT
SEARCHEFF_PIPELINE_LOGIC_FILE:  $SNDATA_ROOT/models/searcheff/SEARCHEFF_PIPELINE_LOGIC.DAT

GENRANGE_REDSHIFT:  0.01    0.5
GENSIGMA_REDSHIFT:  0.000001
GENRANGE_TREST:   -20.0    80.0   # rest epoch relative to peak (days)

DNDZ: POWERLAW  2.6E-5  2.2   # rate=2.6E-5*(1+z)^1.5 /yr/Mpc^3

# R0 Beta Zmin Zmax
# DNDZ: POWERLAW2 2.2E-5 2.15 0.0 1.0   # rate = R0(1+z)^Beta
# DNDZ: POWERLAW2 9.76E-5 0.0 1.0 2.0   # constant rate for z>1

OPT_MWEBV: 1   # simulate galactic extinction from values in SIMLIB file

# smear flags: 0=off, 1=on
SMEARFLAG_FLUX:    1   # photo-stat smearing of signal, sky, etc ...
SMEARFLAG_ZEROPT:  1   # smear zero-point with zptsig

APPLY_CUTWIN_OPT:     1
CUTWIN_NEPOCH:   5 -5.
CUTWIN_TRESTMIN: -20  10
CUTWIN_TRESTMAX:   9  40
CUTWIN_MWEBV:      0 .20
CUTWIN_SNRMAX:   5.0 griz 2 -20. 80.   # require 1 of griz with S/N > 5

FORMAT_MASK:  2   # terse format

# SALT shape and color parameters
GENMEAN_SALT2x1:     0.703
GENRANGE_SALT2x1:   -5.0  +4.0   # x1 (stretch) range
GENSIGMA_SALT2x1:    2.15  0.472   # bifurcated sigmas

GENMEAN_SALT2c:     -0.04
GENRANGE_SALT2c:   -0.4   0.4   # color range
GENSIGMA_SALT2c:    0.033   0.125   # bifurcated sigmas

# SALT2 alpha and beta
GENMEAN_SALT2ALPHA:   0.14
GENMEAN_SALT2BETA:   3.1

# cosmological params for lightcurve generation and redshift distribution
OMEGA_MATTER:  0.3
OMEGA_LAMBDA:  0.7
W0_LAMBDA:    -1.00
H0:            70.0

# SIMGEN_DUMPALL:  10  CID  Z  PEAKMJD S2c S2x1 SNRMAX MAGT0_r MAGT0_g MJD_TRIGGER
SIMGEN_DUMP: 7  CID Z S2c S2x1 TRESTMIN TRESTMAX MJD0

The error lines of the output in linux are the following:

Begin Generating Lightcurves.
  Found Max dN/dz * wgt = 4.937213e+05 at z =    0.500
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)

and in mac, the program kept running for a long time even for few light curves with no output after the following lines:

Begin Generating Lightcurves.   
  Found Max dN/dz * wgt = 4.937213e+05 at z =    0.500 

We are using SNDATA_ROOT-PUBLIC-2020-07-11. We appreciate if you can help us debugging these errors. Thank you

djones1040 commented 3 years ago

Hi jorgearayac, I can't seem to reproduce the error but I can at least provide a few details from my machine. First off, not sure if the starterkit docs say this but on my Mac with GCC version 10 I have to set these flags in the Makefile for it to compile:

FFC  = gfortran  -fallow-argument-mismatch -fcommon
#CC   = cc
CC   = gcc -fcommon

In terms of my actual compilers, here's what I'm working with

(base) Chihiro:simulation David$ gfortran --version
GNU Fortran (Homebrew GCC 10.2.0) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(base) Chihiro:simulation David$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I just did a git pull to make sure I had the latest SNANA version as well. Hope that helps to figure out why it's not working on your machine.