Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running the code and syntax error #228

Open
lizhengduo opened this issue Dec 6, 2024 · 1 comment
Open

running the code and syntax error #228

lizhengduo opened this issue Dec 6, 2024 · 1 comment

Comments

@lizhengduo
Copy link

hello! i use picaso to get a brown dwarf spectrum, and get error called "syntax error", and i don't know how to fix:
Traceback (most recent call last):
File "/bdtest.py", line 73, in
df = bd.spectrum(opa, full_output=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/miniconda3/envs/xesmf_env/lib/python3.12/site-packages/picaso-3.3-py3.12.egg/picaso/justdoit.py", line 3731, in spectrum
return picaso(self, opacityclass,dimension=dimension,calculation=calculation,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
/miniconda3/envs/xesmf_env/lib/python3.12/site-packages/picaso-3.3-py3.12.egg/picaso/justdoit.py", line 228, in picaso
get_opacities(atm,exclude_mol=exclude_mol)
File "/miniconda3/envs/xesmf_env/lib/python3.12/site-packages/picaso-3.3-py3.12.egg/picaso/optics.py", line 2604, in get_opacities_nearest
data = self._get_query_molecular(ind_pt,molecules,cur)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
/miniconda3/envs/xesmf_env/lib/python3.12/site-packages/picaso-3.3-py3.12.egg/picaso/optics.py", line 2492, in _get_query_molecular
cur.execute("""SELECT molecule,ptid,opacity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: near "(": syntax error

@lizhengduo
Copy link
Author

this error fixed by gpt, it changed the optics.py _get_query_continuum and _get_query_molecular functions, just syntax error.
if len(tcia) == 1:
query_temp = "AND temperature = ?"
else:
query_temp = "AND temperature IN ({})".format(','.join(['?'] * len(tcia)))

    if len(cia_mol) == 1:
        query_mol = "WHERE molecule = ?"
    else:
        query_mol = "WHERE molecule IN ({})".format(','.join(['?'] * len(cia_mol)))


    query_params = tuple(cia_mol) + tuple(tcia)

    cur.execute("""
        SELECT molecule, temperature, opacity 
        FROM continuum 
        {} 
        {}
    """.format(query_mol, query_temp), query_params)

the same for _get_query_molecular.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant