Comments (2)
This is a follow up.
It seems that I can define def get_data(self, config, catalog):
as the following,
def get_data(self, config, catalog):
args = parser.parse_args()
x_label = args.x
y_label = args.y
xlabel = fits_label(config.__getitem__(x_label))
ylabel = fits_label(config.__getitem__(y_label))
x = catalog[xlabel]
y = catalog[ylabel]
This way I'm able to retrieve x_label = r2500_band_lumin
value. Unfortunately, I still get a KeyError
message but I'm working that out.
I used the user input arguments for the x
and y
values and define them as x_label
and y_label
. This is an alternative to def get_data(options):
from the master
branch.
from clustr.
I wrote the __getitem__()
function of the Config
class so that you can access it like a normal dictionary, so you don't need to do config.__getitem__(x_label)
.
The key error just means that there is no entry for x_label
in the config. In the master branch that is because it is passed as a command line argument rather than through the config. Personally I think that is probably the better way, so you can quickly explore different x,y fits on a catalog with the same config settings. But we could move it to the config if you'd like.
Here's the short version of what I'd suggest:
# in main():
args = parser.parse_args()
config = Config(args)
...
# in Config():
def __init__(args):
self.config_filename = args.config_file
self.x = args.x
self.y = args.y
with open(self.config_filename, 'r') as stream:
self._config = yaml.safe_load(stream)
return
This way now constructs a Config
purely from the command line arguments. It still grabs the config_file
from args
, but also grabs other useful things like the x
and y
names that are passed to fits_label()
in the master branch.
from clustr.
Related Issues (20)
- Fix incorrect scatter plot legend
- Make PEP 8 compatible
- Don't hard-code flags HOT 1
- Switch flag type to enum HOT 1
- Use warnings module
- x axis wrong? HOT 8
- CluStR rewrite!
- Rewrite branch needs to consolidate code HOT 6
- fitter class HOT 6
- getting rid of R HOT 6
- using parts other peoples code? HOT 4
- plotting HOT 4
- Complete first-pass run of updated pipeline HOT 12
- run_options HOT 1
- fit function of fitter class won't run HOT 30
- Plotlib.py Rework HOT 7
- Flags for Rewrite HOT 7
- SNR flag HOT 5
- to do HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clustr.