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

handle missing modes more gently (from Bitbucket) #10

Open
sfield17 opened this issue Jun 28, 2020 · 1 comment
Open

handle missing modes more gently (from Bitbucket) #10

sfield17 opened this issue Jun 28, 2020 · 1 comment
Assignees

Comments

@sfield17
Copy link
Contributor

This is from Richard:

  • Right now, EvaluateSurrogate accepts 'ell_m', a list of modes to load
  • Until I look at the surrogate file itself, I don't know what modes are available (e.g., single mode vs multi mode)
  • If I pass an 'ell_m' list that includes modes that aren't available in the surrogate (e.g., all modes below some lmax; modes with m<0, for a reflection-symmetric model), the code fails to find them in the .h5 file, and fails.

Would it be possible to modify 'CreateManyEvaluateSingleModeSurrogate' (old interface) to either handle requested but missing modes more gently, by taking the intersection of the modes that are requested and the modes that are available? In about line 780 in surrogate.py?

Specifically, the following

   ### compile list of available modes ###
  modes_available =[]
  for kk in fp.keys():
      splitkk = kk.split('_')
      if splitkk[0][0] == 'l' and splitkk[1][0] == 'm':
        ell = int(splitkk[0][1])
        emm = int(splitkk[1][1:])
        if not (ell, emm) in exc_modes:
          modes_available.append((ell,emm))
  if ell_m is None:
    mode_keys = modes_available
  else:
    mode_keys = []
    for i, mode in enumerate(ell_m):
      if mode in exc_modes:
        print "WARNING: Mode (%d,%d) is both included and excluded! Excluding it."%mode 
      else:
        if mode in modes_available:
          mode_keys.append(mode)
@sfield17
Copy link
Contributor Author

sfield17 commented Apr 6, 2021

Suggested fix:

  • try evaluating models with missing modes and see what happens. Is the message clear? If not change it.

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

2 participants