Giter VIP home page Giter VIP logo

candid's Introduction

I am an 🔭astronomer🔭 keen on sharing my experience and expertise via my codes! I thouroughly check my implementations for accuracy, but these are still research codes, and they may contain bugs: If you use my codes, please give me feedback (report issues, request features, etc). The codes below have reference publications, and have been used in more than 80 refereed publications as of mid-2023.

candid's People

Contributors

amerand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

candid's Issues

Print statement breaks with single wavelength value

Hello,
First, thank you for this package -- we used it during the commissioning of JWST AMI mode and it has been very useful.
With the latest update (version 1.0.7, #1a3151c0fdc1484f11fe06c6608d9e94df13c3cc) I find that candid.py lines 1295-1296 break the fitting routine when the EFF_WAVE is a single float, specifically:

1295     print(' | EFF_BAND/gradient(EFF_WAVE)', hdu.header['INSNAME'], '~',
-> 1296         '%.3f'%np.mean(hdu.data['EFF_BAND']/np.gradient(hdu.data['EFF_WAVE'])))

ValueError: Shape of array too small to calculate a numerical gradient, at least (edge_order + 1) elements are required.

The issue here is taking e.g. np.gradient([3.8e-6]) since EFF_WAVE can be a single value for one channel/filter. Could this print statement be altered to accommodate that?
Thank you.

Gradient calculation error for SPHERE-SAM data

Dear CANDID builders,

I downloaded the latest version of CANDID a few days ago in order to process some SPHERE-SAM data (after extracting the observables using AMICAL). Note that I cross-checked the consistency and validity of the oifits files created with other dedicated tools from JMMC.

However, when I open my oifits file with CANDID, I have the following error:

cal1cal2 = candid.Open(file) 
   ...:                                                                                                                                                   
 | loading file /xxx/xxx/
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-c04a41cc609e> in <module>
      1 file = '/xxx/xxx/SPHERE_K1_CAL1CAL2.oifits'
----> 2 cal1cal2 = candid.Open(file)

~/Coding/CANDID-master/candid/__init__.py in __init__(self, filename, rmin, rmax, reducePoly, wlOffset, alpha, v2bias, instruments, largeCP)
   1137             self.titleFilename = os.path.basename(filename)
   1138             self._initOiData()
-> 1139             self._loadOifitsData(filename, reducePoly=reducePoly, largeCP=largeCP)
   1140 
   1141         print(' | compute aux data for companion injection')

~/Coding/CANDID-master/candid/__init__.py in _loadOifitsData(self, filename, reducePoly, largeCP)
   1297                 if type(hdu.data['EFF_WAVE'])==np.ndarray:
   1298                     print(' | EFF_BAND/gradient(EFF_WAVE)', hdu.header['INSNAME'], '~',
-> 1299                         '%.3f'%np.mean(hdu.data['EFF_BAND']/np.gradient(hdu.data['EFF_WAVE'])))
   1300                 else:
   1301                     # -- nothing to do

<__array_function__ internals> in gradient(*args, **kwargs)

~/opt/anaconda3/envs/candid_env/lib/python3.6/site-packages/numpy/lib/function_base.py in gradient(f, *varargs, **kwargs)
   1046         if f.shape[axis] < edge_order + 1:
   1047             raise ValueError(
-> 1048                 "Shape of array too small to calculate a numerical gradient, "
   1049                 "at least (edge_order + 1) elements are required.")
   1050         # result allocation

ValueError: Shape of array too small to calculate a numerical gradient, at least (edge_order + 1) elements are required.

It seems to be due to the EFF_BAND keyword as SPHERE data contains only one wavelength. The gradient computation on the wavelength table therefore crashes and prevents from using CANDID on SPHERE-SAM data...

Thanks a lot for your help,
All the best,
Faustine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.