xpdAcq / xpdAcq

Acquisition packages for XPD-28 beamline at BNL
http://xpdacq.github.io/xpdAcq/
Other
3 stars 15 forks source link

[bug] acquire_obj.md and acquire_obj.attribute give different results #74

Closed chiahaoliu closed 8 years ago

chiahaoliu commented 8 years ago

For some unknown reason, acquire_obj.md gives whole contents of dictionary, while acquire_obj.attribute yields partially content or even AttributeError.

For example,

in[]: ScanPlan.md
out[]: {....., sc_parms:{exposure: 1, subs: livetable}, sc_usermd:{this:that} }
in[]:ScanPlan.sc_params
out[]: {exposure:1}
in[]: ScanPlan.sc_usermd
out[]: AttributeError

Same to issue #70

sbillinge commented 8 years ago

I don't understand this example, do you mean

typing myscanplan.md returns {....., sc_parms:{exposure: 1, subs: livetable}, sc_usermd:{this:that} } typing myscanplan.sc_params returns {exposure:1} typing myscanplan.sc_usermd returns AttributeError?

In that case, you have to make sure that sc_usermd is properly assigned in ScanPlan

try:
    self.sc_usermd = kwargs
except someError:   #not sure which it will throw if **kwargs is absent
    self.sc_usermd = {}

sthg like that? S

On Mon, Feb 15, 2016 at 11:38 AM, Timothy Liu notifications@github.com wrote:

For some unknown reason, acquire_obj.md gives whole contents of dictionary, while acquire_obj.attribute yields partially content or even AttributeError.

For example,

ScanPlan.md = {....., sc_parms:{exposure: 1, subs: livetable}, sc_usermd:{this:that} } ScanPlan.sc_params = {exposure:1} ScanPlan.sc_usermd --> AttributeError

Same to issue #70 https://github.com/xpdAcq/xpdAcq/issues/70

— Reply to this email directly or view it on GitHub https://github.com/xpdAcq/xpdAcq/issues/74.


Prof. Simon Billinge

Applied Physics & Applied Mathematics Columbia University 500 West 120th Street Room 200 Mudd, MC 4701 New York, NY 10027 Tel: (212)-854-2918 (o) 851-7428 (lab)

Condensed Matter Physics and Materials Science Dept. Brookhaven National Laboratory P.O. Box 5000 Upton, NY 11973-5000 (631)-344-5661

email: sb2896 at columbia dot edu home: http://thebillingegroup.com

sbillinge commented 8 years ago

@chiahaoliu I am not sure what this one is about. Is it fixed?

chiahaoliu commented 8 years ago

Just revisited it. I think it was not a bug, just I misunderstood it. <object_type>_usermd is never an attributes in our design (and it should not be, I agree). <object_type>_usermd is just a dictionary nested inside <object>.md. Close.