imcgreer / simqso

Module for generating simulated quasar spectra
BSD 3-Clause "New" or "Revised" License
12 stars 11 forks source link

comparing bytes and strings #31

Open londumas opened 4 years ago

londumas commented 4 years ago

The following code does not work, https://github.com/imcgreer/simqso/blob/f0666283159d0e5514f0eb4a46522a10d65dd367/simqso/hiforest.py#L29 it should be replaced by the following

if 'HI' in linelist.ION[i]])
Traceback (most recent call last):
  File "rrarchetypes", line 229, in <module>
    flux, subtype = get_quasars(args.nb,wave,args.seed)
  File "rrarchetypes", line 168, in get_quasars
    data['QSO']['FLUX'], data['QSO']['WAVE'], data['QSO']['META'], data['QSO']['OBJMETA'] = SIMQSO(basewave_max=10e4).make_templates(nmodel=data['QSO']['NB'],
  File "<HOME>/desisim/py/desisim/templates.py", line 2352, in __init__
    from simqso.sqbase import ContinuumKCorr, fixed_R_dispersion
  File "<HOME>/simqso/simqso/__init__.py", line 5, in <module>
    from .sqrun import qsoSimulation
  File "<HOME>/simqso/simqso/sqrun.py", line 12, in <module>
    from . import hiforest
  File "<HOME>/simqso/simqso/hiforest.py", line 37, in <module>
    transitionParams = _getlinelistdata()
  File "<HOME>/simqso/simqso/hiforest.py", line 28, in _getlinelistdata
    Hlines = np.array([i for i in range(linelist.size) 
  File "<HOME>/simqso/simqso/hiforest.py", line 29, in <listcomp>
    if b'HI' in linelist.ION[i]])
TypeError: 'in <string>' requires string as left operand, not bytes