Skip to content

Conversation

@Gerenjie
Copy link
Contributor

Add generateEphemerides task and SSPAuxiliaryFile storage class.

@natelust
Copy link
Contributor

natelust commented Nov 3, 2025

rebase your commits to have approximately meaningful commits (i.e. not something like "jakes changes")

Copy link
Contributor

@natelust natelust left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make some changes and I'll take another look. Overall looks reasonable

innerTractSkyRegion,
skyInfo.wcs)
associatedSsSources = associatedSsSources[ssInTractPatch]
print('masked', len(ssInTractPatch), 'ssSources to', sum(ssInTractPatch), 'in tract-patch')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No print messages. IF it is important, use the logger

from lsst.pipe.base import connectionTypes, NoWorkFound, PipelineTask, \
PipelineTaskConfig, PipelineTaskConnections, Struct
import lsst.pipe.tasks
from lsst.utils.timer import timeMethod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a mix off all different imports, direct symbols, import as, and bare import. Please prefer directly importing the symbols you need, i.e from lsst.pex.config import Field,...

]:
self.log.info(f'writing {filename}')
open(cache + filename, 'wb').write(fileref.fileContents.read())
meta_kernel_text = f"""\\begindata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't break up lines like this to avoid space use text wrap.dedent

inputVisits.to_sql('observations', conn, if_exists='replace', index=False)
conn.close()

open(f'{tmpdirname}/eph.ini', 'w').write(eph_str)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use context manager

('naif0012.tls', naif0012),
]:
self.log.info(f'writing {filename}')
open(cache + filename, 'wb').write(fileref.fileContents.read())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use context manager

\\begintext
"""
open(f'{tmpdirname}/sorcha_cache/meta_kernel.txt', 'w').write(meta_kernel_text)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use context manager

open(f'{tmpdirname}/sorcha_cache/meta_kernel.txt', 'w').write(meta_kernel_text)
self.log.info('Sorcha process begun')

result = subprocess.run(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like sorcha is written in python. Do not call the command line through subprocess, you should be making api calls against the code base.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can make this change but would really prefer not to. Sorcha is written in python, but only designed to be run from the command line. I could make api calls to the base code, but would have to construct a SorchaConfig and SorchaArgs object, both of which are opaque and were not designed as the normal interface by the Sorcha team.

If there's a hard rule against command line / subprocess, I can move to in-python Sorcha calls, but I think it would make the code less readable and actually break Sorcha's intended use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've heard a bit more from pipelines folks about why child processes are unsupported in pipetasks. Might be worth a quick zoom chat to discuss options.

# Format DRP ephemerides. Needs:
# ra
# dec
# ssObjectId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments seem to not refer to anything, what do they go to?

fileContents = None

def __init__(self, fileContents):
self.fileContents = fileContents
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% reading through the code. I can't tell if you are using binary as a passthrough here and the data is actually stored in a readable way, or if you are indeed writing straight binary to disk. If it is the later we generally discourage that. Is this actually just passthrough to a csv or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a couple exceptions, the underlying data is unreadable binary stuff that we absolutely need to have as a file somewhere. Happy to hear about a better way to write a bunch of heterogenous binary files than open( , 'wb').write(data) but I'm not aware of one.

@Gerenjie Gerenjie force-pushed the tickets/DM-49453 branch 2 times, most recently from 05d85c3 to c30d792 Compare November 3, 2025 22:57
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

Successfully merging this pull request may close these issues.

4 participants