Commits
Takahiro Tsutsumi authored and Ville Suoranta committed c657cba4d3e Merge
330 330 | # function to return selected field, spw, etc |
331 331 | fieldidused=parse_fluxdict(fluxdict, vis, field, spw, observation, timerange, |
332 332 | scan, intent, usescratch) |
333 333 | |
334 334 | if len(fieldidused): |
335 335 | |
336 336 | retval={} |
337 337 | for selfld in fieldidused: |
338 338 | #selspix=fluxdict[selfld]["spidx"][1] # setjy only support alpha for now |
339 339 | selspix=fluxdict[selfld]["spidx"][1:] # omit c0 (=log(So)) |
340 + | if abs(selspix[0]) > 10.0: |
341 + | if selspix[0] < 0: |
342 + | msg = 'less than -10!' |
343 + | else: |
344 + | msg = 'greater than 10!' |
345 + | raise Exception(f'Field {selfld}: the spectral index is {msg}') |
340 346 | # set all (even if fluxdensity = -1 |
341 347 | if spw=='': |
342 348 | selspw = [] |
343 349 | invalidspw = [] |
344 350 | for ispw in fluxdict["spwID"].tolist(): |
345 351 | # skip spw if fluxd=-1 |
346 352 | if fluxdict[selfld][str(ispw)]["fluxd"][0]>-1: |
347 353 | selspw.append(ispw) |
348 354 | else: |
349 355 | invalidspw.append(ispw) |
385 391 | # for im.setjy to run with both the stanadard and fluxdensity specified. |
386 392 | # Until CAS-6463 is fixed, need to catch and override inconsistent parameters. |
387 393 | if userFluxDensity and instandard!='manual': |
388 394 | influxdensity=-1 |
389 395 | #raise Exception("Use standard=\"manual\" to set the specified fluxdensity.") |
390 396 | casalog.post("*** fluxdensity > 0 but standard != 'manual' (possibly interaction with globals), override to set fluxdensity=-1.", 'WARN') |
391 397 | |
392 398 | |
393 399 | if spix==[]: # handle the default |
394 400 | spix=0.0 |
401 + | alpha = spix[0] if isinstance(spix,list) else spix |
402 + | if abs(alpha) > 10.0: |
403 + | if alpha < -10.0: |
404 + | msg = 'less than -10' |
405 + | else: |
406 + | msg = 'greater than 10' |
407 + | raise Exception(f'The spectral index is {msg}! Please check the spix parameter.') |
408 + | |
395 409 | # need to modify imager to accept double array for spix |
396 410 | retval=myim.setjy(field=field, spw=spw, modimage=model, fluxdensity=influxdensity, |
397 411 | spix=spix, reffreq=reffreq, standard=instandard, scalebychan=scalebychan, |
398 412 | polindex=polindex, polangle=polangle, rotmeas=rotmeas, |
399 413 | time=timerange, observation=str(observation), scan=scan, intent=intent, |
400 414 | interpolation=interpolation) |
401 415 | |
402 416 | myim.close() |
403 417 | |
404 418 | finally: |