Skip to content

Moves CustomCS to CS class#77

Open
gracetangg wants to merge 8 commits into
USNavalResearchLaboratory:masterfrom
gracetangg:dev-custom
Open

Moves CustomCS to CS class#77
gracetangg wants to merge 8 commits into
USNavalResearchLaboratory:masterfrom
gracetangg:dev-custom

Conversation

@gracetangg
Copy link
Copy Markdown
Contributor

I've moved the CustomCS constructor into the CS class constructor.

I also added a flag for whether or not the CS class is customized, however, this is mainly for whether or not to make the "cs_id" = None if neither the metadata or the data is provided. From the description of CustomCS it seems like the user needs at least one of metadata or data if we are building from an existing CS dataset, so in that case we wouldn't need this flag. But in the tests, we can create CustomCS instances without providing either, so in that case we would need the extra flag, so please let me know what you think.

Addresses #12

@padamson
Copy link
Copy Markdown
Contributor

Thanks for tackling this one, it has been top on my todo list for a while.

I took a stab at adding some tests for exceptions that would be raised to think through how customizing a CS class should work. I'd prefer not to have a flag when calling CS but rather the initializer would recognize whether the user is customizing an existing dataset or creating one from scratch, then raises appropriate exceptions if an illegal combination of cursor, cs_id, data, or metadata are provided.

We could expand the documentation for the CS class to explain what is allowed, and the exception handling will provide additional clarification.

We could have an attribute that is set to indicate whether the CS is builtin (straight out of database), custom (all data/metadata provided when CS was called), or customized (cursor and cs_id provided, and metadata/data provided to over-ride). Not sure what to call the attribute. Perhaps source?

@padamson
Copy link
Copy Markdown
Contributor

In case it's not clear, here is what I'm thinking for the source attribute:

  • customized: a user provides cursor and cs_id, as well as data and/or metadata to override what is in the database. Any metadata can be overridden. For data, if new e, sigma pairs are provided, they are inserted. If existing e, sigma pairs are provided, they are replaced. If e, sigma is provided with sigma=-1, it is removed.
  • custom: a user does not provide cs_id, and provides a sufficient set of data and metadata. metadata that are required are process, lhsA, rhsA, and threshold. (More robust logic for each process TBD.)
  • builtin: just cursor and cs_id are provided with no data/metadata

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.

2 participants