diff --git a/miex_app.py b/miex_app.py index 5986e80..923247c 100644 --- a/miex_app.py +++ b/miex_app.py @@ -5,11 +5,6 @@ import streamlit as st -def conv(line): - # Converter for lambda/n/k database files - return line.replace(b"D", b"e") - - st.set_page_config(page_title="MIEX", page_icon=None) st.title("MIEX App") st.write("This app is a Mie scattering code for large grains written in Python and based on [MIEX](https://ui.adsabs.harvard.edu/abs/2018ascl.soft10019W) by [Wolf & Voshchinnikov (2004)](https://ui.adsabs.harvard.edu/abs/2004CoPhC.162..113W).") @@ -175,7 +170,7 @@ def conv(line): format="%d", step=2, min_value=1, - disabled=not doSA, + disabled=(not doSA), ) st.divider() @@ -236,9 +231,8 @@ def conv(line): if fnames[icomp] is None: st.error("Error: Dust data file missing!") st.stop() - w, n, k = np.loadtxt( - fnames[icomp], unpack=True, comments="#", converters=conv - ) + + w, n, k = np.loadtxt(fnames[icomp], comments="#", unpack=True) if isinstance(w, float): if nlam == 1: diff --git a/miex_notebook_2.ipynb b/miex_notebook_2.ipynb index ee2f645..f27ca72 100644 --- a/miex_notebook_2.ipynb +++ b/miex_notebook_2.ipynb @@ -17,12 +17,7 @@ "# import packages and define functions\n", "import miex.miex as miex\n", "import numpy as np\n", - "import matplotlib.pyplot as plt\n", - "\n", - "\n", - "def conv(line):\n", - " # converter for lambda/n/k database files\n", - " return line.replace(b\"D\", b\"e\")" + "import matplotlib.pyplot as plt" ] }, { @@ -45,7 +40,7 @@ "\n", "# OR use a dust data file (three columns: wavelength/micron real imag)\n", "filename = \"ri-data/silicate\"\n", - "wavelength, ri_real, ri_imag = np.loadtxt(filename, unpack=True, comments=\"#\", converters=conv)\n", + "wavelength, ri_real, ri_imag = np.loadtxt(filename, unpack=True, comments=\"#\")\n", "\n", "nlam = len(wavelength)" ] diff --git a/run_miex.py b/run_miex.py index 776a13a..b545b01 100644 --- a/run_miex.py +++ b/run_miex.py @@ -45,11 +45,6 @@ # ==================================================================================================== -def conv(line): - # Converter for lambda/n/k database files - return line.replace(b"D", b"e") - - def main(input_filename): # --------------------------------------------------------------------------------------------------- # 0. General settings @@ -169,7 +164,6 @@ def main(input_filename): "ri-data/" + fnames[icomp], comments="#", unpack=True, - converters=conv, ) if icomp > 0 and not np.array_equal(wavelength, w[:nlam]): raise Exception("Wavelength distribution in dust data files do not match.")